NoebeConfiguration
这个是Noebe框架的配置对象。包括的属性和方法为:
属性概览 |
|
string |
ConnectionString |
string |
DatabaseName |
DatabaseType |
DatabaseType |
string |
DataSource |
string |
Filename |
bool |
LogOutputToScreen |
string |
LogPath |
string |
Password |
bool |
PrintSQL |
string |
ServerName |
bool |
UseBuffer |
string |
UserName |
Noebe配置Access数据库服务
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = "Demo.mdb";
NoebeManager.Initialize(config);
可见只要指定数据库类型和文件位置就能够访问数据库。
Noebe配置Oracle数据库服务
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Oracle;
config.DataSource = "PIXYSOFT";//对应本地Oracle listener的配置
config.UserName = "NOEBE";
config.Password = "NOEBE";
NoebeManager.Initialize(config);
可见指定了DataSource就可以访问Oracle数据库了。
NoebeConfiguration其他数据库配置
NoebeConfiguration里面的:
l DatabaseName
l ServerName
主要针对MSSQL使用。
ConnectionString
这个是只读属性,用户配置后可以通过这个属性查看连接字符串是否正确。
UseBuffer配置缓存
主要指用户是否使用缓存,使用了缓存后,用户的查询将被缓存到本地,下一次查询将直接从本地读取,加快速度。
缓存机制完全考虑了数据一致性问题,因此用户的所有更新、删除等操作将更新缓存层,保证本地和数据库数据完全一致。
同时,这里先提一下,Noebe提供了基于分布式环境下的数据库同步操作,此功能必须打开缓存才能实现。具体请看分布式操作章节。