Detailed introduction to the latest open source Dblayer

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


Access Code case

var id = theservice.insertentity<syslog, long> (        () = new SysLog ()        {            Logid =-1,            Logcontentjson = "Test",            logcreater = "Test",            logcreatetime = DateTime.Now,            logtype = "1"});
Paging operations
        <summary>///page Query///</summary>///<param name= "condition" > Query conditions </param>///<returns ></returns>public ienumerable<sysuser> seach (sysusercondition.search condition) {var page = new Page                R<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_em                        Ail "); 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; }

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

  <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>

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

 <object id= "Uuidgenerator" type= "DBLayer.Persistence.UUIDGenerator, Dblayer.persistence "singleton=" true "> <!--workerid: Zone (Room): 3 bits--> <constructor-arg name=" Workerid "V alue= "1"/> <!--RegionID: Machine number: bits--> <constructor-arg name= "RegionID" value= "1"/> <!--Twepoc H: Base time: Thu, 01:42:54 gmt--> <!--(long) (Datetime.utcnow-new DateTime (1970, 1, 1, 0, 0, 0, Datetimeki nd. UTC). totalmilliseconds--> <constructor-arg name= "Twepoch" value= "1288834974657"/> </object> 
Related Article

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.