Noebe 2.0 Enterprise Edition 美味的持久层
Noebe 2.0 Enterprise Edition 美味的持久层
介绍:
一个企业应用级别的数据库持久层。在许多的大公司中实际应用,并且稳定。
联系方法:
特点:
无需写任何xml,立刻使用。
支持CRUD的所有操作。
支持自定义sql操作。
特色功能:
。支持Oracle, Access, mySQL, MSSQL, DB2, SyBase等流行数据库
。自动感知数据库表结构,不需要再写任何一行XML配置代码,彻底脱离配置文件的烦恼。
。智能缓存设计,使用MRU算法,让查询变得飞快。
。分布式数据库同步操作,让数据库操作的同步冲突不再存在。
。智能主键填充,不需要为主键值而担心。
。事务操作,让数据库更加安全。
。拥有强大的LOG功能,彻底跟踪数据库操作情况。
下载:
/Files/zc22/Noebe2.0.rar
测试数据库:
/Files/zc22/noebe_db.rar
快速入门:
注意:以下代码全部可以执行,无需写任何配置文件。
自定义语句:
public void Testmanual()
{
//初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//数据库全选
NoebeManager.Instance.NoebeAdapter.Fill(table, "SELECT * FROM TESTTABLE WHERE ID=11373");
}
{
//初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//数据库全选
NoebeManager.Instance.NoebeAdapter.Fill(table, "SELECT * FROM TESTTABLE WHERE ID=11373");
}
选择:
public void TestSelect()
{
//初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//数据库全选
NoebeManager.Instance.Querion.Select(table);
}
{
//初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//数据库全选
NoebeManager.Instance.Querion.Select(table);
}
插入:
public void TestInsert()
{
//初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//填数据:
for (int i = 0; i < 10; i++)
{
DataRow row = table.NewRow();
row[1] = "pixysoft" + i;
table.Rows.Add(row);
}
//插入:
NoebeManager.Instance.Session.Insert(table);
}
{
//初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//填数据:
for (int i = 0; i < 10; i++)
{
DataRow row = table.NewRow();
row[1] = "pixysoft" + i;
table.Rows.Add(row);
}
//插入:
NoebeManager.Instance.Session.Insert(table);
}
更新:
public void TestUpdate()
{ //初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//数据库全选
NoebeManager.Instance.Querion.SelectByPk(table, "11373");
table.Rows[0][1] = "Test Update!";
NoebeManager.Instance.Session.Update(table);
}
{ //初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//数据库全选
NoebeManager.Instance.Querion.SelectByPk(table, "11373");
table.Rows[0][1] = "Test Update!";
NoebeManager.Instance.Session.Update(table);
}
删除:
public void TestDelete()
{ //初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//数据库全选
NoebeManager.Instance.Querion.SelectByPk(table, "11373");
table.Rows[0][1] = "Test Update!";
NoebeManager.Instance.Session.Delete(table);
}
{ //初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//数据库全选
NoebeManager.Instance.Querion.SelectByPk(table, "11373");
table.Rows[0][1] = "Test Update!";
NoebeManager.Instance.Session.Delete(table);
}
事务:
public void TestTransaction()
{ //初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//数据库全选
NoebeManager.Instance.Querion.SelectByPk(table, "1");
Transaction tran = NoebeManager.Instance.Transaction;
tran.Begin();
NoebeManager.Instance.Transaction.Update(table);
table.Rows[0][1] = "Test Transaction 2!";
tran.Commit();
}
{ //初始化配置:
NoebeConfiguration config = new NoebeConfiguration();
config.DatabaseType = DatabaseType.Access;
config.Filename = @"e:\temp\demo.mdb";
config.PrintSQL = true;
config.LogOutputToScreen = true;
NoebeManager.Initialize(config);
//取得表:
DataTable table = NoebeManager.Instance.GetEntity("TESTTABLE");
//数据库全选
NoebeManager.Instance.Querion.SelectByPk(table, "1");
Transaction tran = NoebeManager.Instance.Transaction;
tran.Begin();
NoebeManager.Instance.Transaction.Update(table);
table.Rows[0][1] = "Test Transaction 2!";
tran.Commit();
}
声明:
基本原则:让技术流动!
任何技术如果静止,那么一定会死的。所以希望有兴趣的人一起加入我们,让技术不断积累。很希望您和我们联系,我们会把Noebe的所有源代码告诉您,并且解释里面的代码含义,让您尽快的掌握。
同时我们很希望您能够有更多的想法,不断完善noebe.