同步操作将从 yhh1234/GFORMFrame 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
支持多数据库 user_DB shop_DB 支持异构数据库 如 mysql oracle msssql access txt sqlslite db csv SqlServerCe excel 等 支持数据库主从链接内容 Conscbuji2Conn_Slave1 Conscbuji2Conn_Slave2 ... 支持 DAPPER 支持 HELPER dbhelper 支持实体映射 select 未来会 或者已经支持EF 内容 本项目使用 2.0 架构开发 和引入 因为站在巨人们的肩膀上 包括cydata dapper EFcore 未来会结合mycat 处理内容观察 APP.config 或者 web.config 的支持内容为: 如果出现问题请 提交相应的readme.MD 谢谢 联系方式为 :QQ:884269094
<add name="zzld_sckzConn" connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\\XiaoMiPc\\EpanForWorkFile\\BMSoftWorkSpace\\BMBIZSoft\zzld\zzld_sckz.mdb"/>
<add name="JFDBMainConn" connectionString="Database=conscbuji2;Server=192.168.0.2;User ID=sa;Password="/>
<add name="bmdbConn" connectionString="Database=bmdb;Server=192.168.0.2;User ID=sa;Password="/>
<!--<add name="JFDBMainConn" connectionString="Database=northwind;Server=127.0.0.1;User ID=sa;Password=sql"/>-->
<!--<add name="Conn" connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT = 1521)))(CONNECT_DATA =(SID = Aries)));User ID=sa;password=123456" />
<add name="Conn" connectionString="host=127.0.0.1;Port=3306;Database=aries;Uid=root;Pwd=123456;Charset=utf8" />
-->
Demo static void Main(string[] args) { string providename; //bool result = DBTool.TestConn(AppConfig.DB.DefaultConn);//检测数据库链接是否正常 //OutMsg("数据库链接:" + result); //new MAction(Conscbuji2Enum.shipformulaa,AppConfig.GetConn("Conscbuji2Conn", out providename))
using (MAction action = new MAction(CrossDb.GetEnum("shipformulaa")))
{
MDataTable dt;
dt = action.Select(1, 10, "order by " + action.Data.PrimaryCell.ColumnName + " desc");
Console.WriteLine(dt.Rows.Count);
Console.WriteLine(dt.ToJson(false, false,false));
}
//CrossDb.GetEnum("peibi")
//,AppConfig.GetConn("zzld_sckzConn", out providename)
Console.WriteLine("---------------------------------------------------------------");
using (MAction action = new MAction(CrossDb.GetEnum("peibi")))
{
MDataTable dt;
dt = action.Select(1, 10, "order by " + action.Data.PrimaryCell.ColumnName + " desc");
Console.WriteLine(dt.Rows.Count);
Console.WriteLine(dt.ToJson(false, false, false));
//action.ConnectionString;
//dbunnity;
//DbBase db = DalCreate.CreateDal(DefaultConn);
}
Console.WriteLine("---------------------------------------------------------------");
//DBFast helper = CYQ.Data.DalCreate.CreateDal(AppConfig.GetConn("zzld_sckzConn", out providename));
//链接的共用和复用处理
//
Console.WriteLine("----------------------");
//
//
//using (GBFramer gf = GBFramer.GetInstance())
//{
//}
{
GBFramer gf = ORMHelper.DB;
Console.WriteLine(gf.Mainconectstring);
//gf.DbConnecttionTwo;
if (gf.DbConnecttionTwo.State == System.Data.ConnectionState.Closed)
{
gf.DbConnecttionTwo.Open();
}
var r = gf.DbConnecttionTwo.Execute(@"
insert into
con02para(con02parid, con0201, con0202, con0203, con0204)
values (@a, @b,@c,@d,@e)
",
new[] {
new { a = Math.Abs(BitConverter.ToInt32(Guid.NewGuid().ToByteArray(), 0)) , b = 1, c = 1, d = DateTime.Now.ToString(), e = 1 }
,new { a = Math.Abs(BitConverter.ToInt32(Guid.NewGuid().ToByteArray(), 0)), b = 2, c = 2, d = DateTime.Now.ToString(), e = 2 }
,new { a = Math.Abs(BitConverter.ToInt32(Guid.NewGuid().ToByteArray(), 0)), b = 3, c = 3, d = DateTime.Now.ToString(), e = 3 }
});
Console.WriteLine("插入结果为:" + r.ToString());
var a = gf.DbConnecttionTwo.Query<Shipformulaa>
("select formulaid, shipid2, formulatype, bujino, item01, item02, item03, item04, item05, item06, item07, item08, item09, item10, item11, item12, item13, item14, item15, item16, item17, item18, item19, item20, item21, item22, item23, item24, item25, item01gg, item02gg, item03gg, item04gg, item05gg, item06gg, item07gg, item08gg, item09gg, item10gg, item11gg, item12gg, item13gg, item14gg, item15gg, item16gg, item17gg, item18gg, item19gg, item20gg, item21gg, item22gg, item23gg, item24gg, item25gg, strength, slump, diameter, datatype, updid, updtime, slumpdiff, memo, item01name, item02name, item03name, item04name, item05name, item06name, item07name, item08name, item09name, item10name, item11name, item12name, item13name, item14name, item15name, item16name, item17name, item18name, item19name, item20name, item21name, item22name, item23name, item24name, item25name from Shipformulaa where bujino>@id", new { id = "0" });
//conn.Close();
List<DbParameter> lstparams = new List<DbParameter>();
//SqlParameter
DbParameter para = ORMHelper.DB.Biz.Dao.CreateParameter("@id", DbType.Int32, 0);
lstparams.Add(para);
DataTable dt = ORMHelper.DB.Dapper.ExecuteDataTable("select formulaid, shipid2, formulatype, bujino, item01, item02, item03, item04, item05, item06, item07, item08, item09, item10, item11, item12, item13, item14, item15, item16, item17, item18, item19, item20, item21, item22, item23, item24, item25, item01gg, item02gg, item03gg, item04gg, item05gg, item06gg, item07gg, item08gg, item09gg, item10gg, item11gg, item12gg, item13gg, item14gg, item15gg, item16gg, item17gg, item18gg, item19gg, item20gg, item21gg, item22gg, item23gg, item24gg, item25gg, strength, slump, diameter, datatype, updid, updtime, slumpdiff, memo, item01name, item02name, item03name, item04name, item05name, item06name, item07name, item08name, item09name, item10name, item11name, item12name, item13name, item14name, item15name, item16name, item17name, item18name, item19name, item20name, item21name, item22name, item23name, item24name, item25name from Shipformulaa where bujino>@id",
lstparams, 300, ORMHelper.DB.ProviderName);
Console.WriteLine(dt.Rows.Count);
Console.WriteLine("============================");
//这里引入对应newjson
string jsondt = string.Empty;
jsondt = JsonConvertHelper.Serialize(dt);
List<Shipformulaa> lstshipfa = new List<Shipformulaa>();
lstshipfa = (List<Shipformulaa>)JsonConvertHelper.Deserialize(jsondt, lstshipfa.GetType());
Console.WriteLine(lstshipfa.Count);
Console.WriteLine(jsondt);
//
a.ToList();
Console.WriteLine(JsonHelper.ToJson(a, false));
Console.WriteLine("==============下面是多结果集内容=============");
List<DbParameter> lstparams2 = new List<DbParameter>();
//SqlParameter
DbParameter para2 = ORMHelper.DB.Biz.Dao.CreateParameter("@id", DbType.Int32, 0);
lstparams2.Add(para2);
DataSet ds = ORMHelper.DB.Dapper.ExecuteDataSet(
@"
select formulaid, shipid2, formulatype, bujino, item01, item02, item03, item04, item05, item06, item07, item08, item09, item10, item11, item12, item13, item14, item15, item16, item17, item18, item19, item20, item21, item22, item23, item24, item25, item01gg, item02gg, item03gg, item04gg, item05gg, item06gg, item07gg, item08gg, item09gg, item10gg, item11gg, item12gg, item13gg, item14gg, item15gg, item16gg, item17gg, item18gg, item19gg, item20gg, item21gg, item22gg, item23gg, item24gg, item25gg, strength, slump, diameter, datatype, updid, updtime, slumpdiff, memo, item01name, item02name, item03name, item04name, item05name, item06name, item07name, item08name, item09name, item10name, item11name, item12name, item13name, item14name, item15name, item16name, item17name, item18name, item19name, item20name, item21name, item22name, item23name, item24name, item25name from Shipformulaa where bujino>@id;
select top 10 queuekey, carid, formulaid, bujiqty, shiptime, engname, workpart, sumno, sumqty, empid, empname, shipaddr, bujistatus, bujistime, formulatype, shipid2, datatype, updid, updtime, othertxt01, othertxt02, othertxt03, Ordid, Pbqty, pb12, pb33, ph14, ph18, logtype, logupdid, logupdtime, pb15a, pb22 from bujiq1alog ;
",
lstparams2, 300, ORMHelper.DB.ProviderName);
Console.WriteLine(JsonConvertHelper.Serialize(ds));
//bmdbConn
GBFramer bmdbgf = ORMHelper.GetDBbyDBname("bmdb");
DataSet ds2 = bmdbgf.Dapper.ExecuteDataSet(
@"
select * from strength
",
null, 300, bmdbgf.ProviderName);
Console.WriteLine("==============下面跨数据库的内容=============");
Console.WriteLine(JsonConvertHelper.Serialize(ds2));
Console.WriteLine("==============下面多数据库相应的内容=============");
using (MAction action = bmdbgf.GetMAction("strength"))
{
MDataTable dt2;
dt2 = action.Select(1, 10, "order by " + action.Data.PrimaryCell.ColumnName + " desc");
Console.WriteLine(dt2.Rows.Count);
Console.WriteLine(dt2.ToJson(false, false, false));
}
}
核心框架 core public static class ORMHelper { private static readonly object LockObj = new object(); private static GBFramer _db; private static GBFramer _db2; public static GBFramer DB { get { if (_db == null) { lock (LockObj) { if (_db == null) { _db = new GBFramer(); } } } return _db; } }
public static GBFramer GetDBbyDBname(string database)
{
if (_db2 == null)
{
lock (LockObj)
{
if (_db2 == null)
{
_db2 = new GBFramer(database);
}
}
}
return _db2;
}
//GBFramer
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。