您好,欢迎访问一九零五行业门户网

最新开源DBLayer的详细介绍

dblayer,我最近开源的数据库轻量级orm框架,目前支持sqlserver、mysql、oracle, 特别做了分页的封装。
这个框架从七八年前开始逐渐升级而来,也经历了不少项目,希望可以将大家从sql字符串中解放出来。
开源地址
访问代码案例
var id = theservice.insertentity<syslog, long>(         () => new syslog()         {             logid = -1,             logcontentjson = 测试,             logcreater = 测试,             logcreatetime = datetime.now,             logtype = 1});
分页操作
/// <summary>/// 分页查询/// </summary>/// <param name="condition">查询条件</param>/// <returns></returns>public ienumerable<sysuser> seach(sysusercondition.search condition)         {var page = new pager<sysusercondition.search>()             {                 condition = condition,                 table = sys_user,                 key = user_id,                 order = string.empty,                 field = *,                 whereaction = (condition, where, paramters) =>{if (!string.isnullorempty(condition.username))                     {                         where.append(and user_name like @user_name );                         paramters.add(base.createparameter(@user_name, string.concat(%, condition.username, %)));                     }if (!string.isnullorempty(condition.useremail))                     {                         where.append(and user_email like @user_email );                         paramters.add(base.createparameter(@user_email, string.concat(%, condition.useremail, %)));                     }if (!string.isnullorempty(condition.usermobile))                     {                         where.append(and user_mobile like @user_mobile );                         paramters.add(base.createparameter(@user_mobile, string.concat(%, condition.usermobile, %)));                     }                 }             };var result = base.getresultbypager<sysuser, sysusercondition.search>(page);return result;         }
推荐和spring 配合使用,具体配置代码请进入源码查看。
同时在spring 配置多个数据库连接,支持数据库连接字符串密码加密。只需要在 passwordkey加入密钥
  <object id="sql_wxius_string_server" type="dblayer.core.connectionstring, dblayer.core" singleton="true">     <property name="properties">       <name-values>         <add key="userid" value="sa" />         <add key="password" value="***" />         <add key="passwordkey" value="" />         <add key="database" value="wxius" />         <add key="datasource" value="." />       </name-values>     </property>     <property name="connectiontoken" value="password=${password};persist security info=true;user id=${userid};initial catalog=${database};data source=${datasource};pooling=true;min pool size=5;max pool size=10" />   </object>
数据库唯一标识除了可以数据自动编码,还支持在代码端自动 生成 guid 和 时间点。下面代码是uuid,时间点并按照顺序生成的自动编号
  <object id="uuidgenerator" type="dblayer.persistence.uuidgenerator, dblayer.persistence" singleton="true" >     <!--workerid:区域(机房):3 bits-->     <constructor-arg name="workerid" value="1"/>     <!--regionid:机器编号:10 bits-->     <constructor-arg name="regionid" value="1"/>     <!--twepoch:基准时间:thu, 04 nov 2010 01:42:54 gmt-->     <!--(long)(datetime.utcnow - new datetime(1970, 1, 1, 0, 0, 0, datetimekind.utc)).totalmilliseconds-->     <constructor-arg name="twepoch" value="1288834974657"/>   </object>
以上就是最新开源dblayer的详细介绍的详细内容。
其它类似信息

推荐信息