Giter Club home page Giter Club logo

netcore-orm-simple's Introduction

NetCore-ORM-Simple

It's the about net core orm
这是一个关于.net core 的 生成sql语句的 框架。

支持数据库:Mysql,Sqlite,SqlService

特点:查询的写法非常优雅

更加详细的中文介绍地址:https://blog.csdn.net/weixin_45394846/article/details/127154931

例子:简单配置只需要配置连接字符串就好了

    '''var simpleClient = new SimpleClient(
        new DataBaseConfiguration(false,
        new ConnectionEntity("链接字符串!") 
        { 
            IsAutoClose = true,
            DBType=eDBType.Mysql,
            Name="test1",
            ReadWeight=5,
            WriteReadType=eWriteOrReadType.ReadOrWrite
        }));

配置需要使用的数据库(它仅仅只是一个生成sql语句的工具) DataBaseConfiguration.DBDrives.Add(eDBType.Mysql,Tuple.Create(typeof(MySqlConnection),typeof(MySqlParameter)));

    var command=simpleClient.Insert(
        new UserEntity() {
            CompanyId=1,
            gIdColumn=Guid.NewGuid(),
            Description="Test",
            Name="Name",Role=10});

      simpleClient.Update(
      new UserEntity()
      {
          CompanyId = 1,
          gIdColumn = Guid.NewGuid(),
          Description = "Test",
          Name = "Name",
          Role = 10
      });

    var query = simpleClient.Queryable<UserEntity, RoleEntity, CompanyEntity>(
        (u, r, c) =>
            new JoinInfoEntity(
                new JoinMapEntity(eJoinType.Inner, u.Role == r.Id && u.Role.Equals((int)eConditionType.Sign)),
                new JoinMapEntity(eJoinType.Inner, u.CompanyId == c.Id)
            )
         )
        .Where((u,r,c)=>u.Id>10&&(r.Id==10||c.Id.Equals((int)eDBType.Mysql)))
        .Select((u,r,c)=>new ViewView
         {
             UserId=r.Id,
             DisplayName=u.Name,
             CompanyName=c.Name,
             RoleName=r.Name,
         }).Select(v=>new
         {
             UID=v.UserId,
             RName=v.RoleName
         });

有兴趣的可以了解了解
这里提供了一简单的实现,尽管代码比较粗糙
Basic use is no problem.
现在呢基本使用已经没有问题了。
写这个玩意呢其实更重要的可能是一个学习的过程,慢慢的完善一些功能和修改其中存在的问题。

netcore-orm-simple's People

Contributors

simplezdm avatar soulzdm10 avatar

Stargazers

 avatar  avatar  avatar timegame avatar

Watchers

 avatar

netcore-orm-simple's Issues

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.