GithubHelp home page GithubHelp logo

mugicon / bitter.core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from davidchild/bitter.core.orm.netcore

0.0 0.0 0.0 633 KB

bitter.core is a high-performance and easy-to-use netcore / netframework orm framework. I think you'll love it. designed for development and efficiency. efficiency, high performance and high stability are always the pursuit of programmers. bittercore was born for that. you want to be lazy, even lazier! simple, more simple! controllable, more controllable! please use it bitter.Core .

Home Page: https://www.cnblogs.com/davidchild

C# 100.00%

bitter.core's Introduction

Bitter.Core -- NETCORE ORM MAPPING Framework。

A simple and easy to use high performance NETCORE / netframework database persistence framework (ORM)

1: Support MSSQL, MySQL

2: Support model query and SQL query

3: One time transaction commit is supported

4: Support bulk transaction commit of buldcopy

5: Support query data model transformation

6: Support exception throwing and transaction interruption

7: Support cross database transaction commit (multiple transactions)

8: Support SQL with optimization

9: Pagination query mode supporting convert, select row mode

10: Support multiple databases

11: Read write separation is supported

12: Support field change collection

Bitter.Core It's a beautiful thing to make programmers lazier!

NUGET

NETCORE: https://www.nuget.org/packages/Bitter.Core.NetCore/

To install Bitter.Core.NetCore , run the following command in the Package Manager Console

PM> Install-Package Bitter.Core.NetCore

Blog

Cnblogs: https://www.cnblogs.com/davidchildblog/category/1916170.html

Simple-Demo

Github:https://github.com/DavidChild/Bitter.Core.Sample.git

Database entities and Attributes

[TableName("t_StudentScore")]
public class TStudentScoreInfo : BaseModel
{
   /// <summary>
   /// It's a Primary key
   /// </summary>
   [Key] //designate the filed is  Primary key
   [Identity] //designate the filed is  Identity
   public virtual Int32 FID { get; set; }

   /// <summary>
   ///  student Id
   /// </summary>
   [Display(Name = @"student Id")]
   public virtual Int32? FStudentId { get; set; }

   /// <summary>
   /// score
   /// </summary>
   public virtual Int32? FScore { get; set; }

   /// <summary>
   /// add time
   /// </summary>
   public virtual DateTime? FAddTime { get; set; }

}

refer to the blog for the description of database model creation: https://www.cnblogs.com/davidchildblog/articles/14276886.html

Databases Connection Config Setting

{

  "connectionString":[
    {
    
     "dbType": "System.Data.SqlClient",
      "name": "MainData.Reader", 
      "value": "Min Pool Size=10;Max Pool Size=500;Connection Timeout=50;Data Source=192.168.99.66,12033;Initial Catalog=readdbname;Persist Security Info=True;User ID=username;Password=pwd; pooling=false"
    },
    {

      "dbType": "System.Data.SqlClient",
      "name": "MainData.Writer",
      "value": "Min Pool Size=10;Max Pool Size=500;Connection Timeout=50;Data Source=192.168.99.66,12033;Initial Catalog=writedbname;Persist Security Info=True;User ID=test;Password=pwd; pooling=false"
    }
   
   ] 
}

db Connection Setting: https://www.cnblogs.com/davidchildblog/articles/14276611.html

SEARCH DEMO

#region According to the conditions of full inquiry students name HJB students
BList<TStudentInfo> students = db.FindQuery<TStudentInfo>().Where(p => p.FName == "HJB").Find();

// Batch query the students whose names are HJB according to the conditions
TStudentInfo student_1 = db.FindQuery<TStudentInfo>().Where(p => p.FName == "HJB").Find().FirstOrDefault(); //The FirstOrDefault method  After refactoring, it is in security mode. If the database can't find the data, it will return null object to avoid returning null
if (student_1.FID > 0) //Description query data
{

}
#endregion
#region Advanced query direct SQL statement query (non pagination)
//Find out the name of the student whose score is > = 90 and the specific credit

DataTable dt=  db.FindQuery(
                   @"SELECT score.FScore,student.FName as studentNameFROM  t_StudentScore score
                    LEFT JOIN t_student student  ON score.FStudentId = student.FID
                    WHERE score.FScore>=@score
                  ", new { score = 90 }).Find();
#endregion
#region  Single table model driven query only queries the first n qualified data, and only returns specific columns (faage, fname)

students = db.FindQuery<TStudentInfo>().Where(p => p.FAage > 15).ThenAsc(p => p.FAage).ThenDesc(p => p.FAddTime).SetSize(10).Select(c=>new object[] { c.FAage,c.FName}).Find(); //The later select (columns) method specifies the columns to query
students = db.FindQuery<TStudentInfo>().Where(p => p.FAage > 15).ThenAsc(p => p.FAage).ThenDesc(p => p.FAddTime).SetSize(10).Select(c => new List<object>{ c.FAage, c.FName }).Find(); //The later select (columns) method specifies the columns to query

#endregion

More Demo Simple: https://www.cnblogs.com/davidchildblog/articles/14276729.html

bitter.core's People

Contributors

davidchild avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.