The latest open source Dblayer, database operation can also be very simple

Source: Internet
Author: User
Tags syslog

Dblayer, my recent open source database lightweight ORM Framework, currently supports SQL Server, MySQL, and Oracle, especially in the paging package.

The framework has been upgraded from 78 ago and has undergone a number of projects, hoping to liberate everyone from the SQL string.

Open Source Address

Https://github.com/wutao0315/DBLayer

Access Code case

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Margin:0px;padding:0px;border:none; "/>

var  id = TheService.InsertEntity<SysLog, long> (          ()  => new syslog ()         {             LogId = -1,             LogContentJson =  "Test",             LogCreater =  "Test",             LogCreateTime = DateTime.Now,             LogType =  "1"          }); 

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Margin:0px;padding:0px;border:none; "/>

Paging operations

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Margin:0px;padding:0px;border:none; "/>

        /// <summary>         ///  Paged Query         /// </summary>         /// <param name= "condition" > Query conditions </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))                      {                       &nBsp; 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;        }

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Margin:0px;padding:0px;border:none; "/>

Recommended for use with spring, the specific configuration code please enter the source view.

Multiple database connections are also configured in spring to support database connection string password encryption. Only need to join the key in Passwordkey

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Margin:0px;padding:0px;border:none; "/>

  <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};D Ata source=${datasource};p ooling=true;min  pool size=5;max pool size=10 " />  </object>

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Margin:0px;padding:0px;border:none; "/>

Database unique identifiers also support automatic generation of GUIDs and point-in-time on the code side, in addition to automatic data encoding. The following code is a UUID, a point in time, and an automatic number generated sequentially

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Margin:0px;padding:0px;border:none; "/>

   <object id= "Uuidgenerator"  type= "dblayer.persistence.uuidgenerator,  Dblayer.persistence " singleton=" true " >    <!--Workerid: Area (room):3  Bits-->    <constructor-arg name= "Workerid"  value= "1"/>     <!--RegionID: Machine number: 10 bits-->    <constructor-arg name= " RegionID " value=" 1 "/>    <!--Twepoch: Base Time:thu, 04 nov 2010  01:42:54 gmt-->    <!--(Long) (Datetime.utcnow - new datetime ( 1970,&NBSP;1,&NBSP;1,&NBSP;0,&NBSP;0,&NBSP;0,&NBSP;DATETIMEKIND.UTC)). Totalmilliseconds-->    <constructor-arg name= "Twepoch"  value= " 1288834974657 "/>&NBSP;&NBSP;</OBJECT> 

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Margin:0px;padding:0px;border:none; "/>


The latest open source Dblayer, database operation can also be very simple

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.