GithubHelp home page GithubHelp logo

sqlsugar.ioc's Introduction

1、简介

SqlSugar.IOC 是SqlSugar官方IOC框架,简单好用 10秒包会

版本支持:

.NET CORE 3.1

.NET5

SqlSugarCore 5.0.2.6 +

2、功能

1、SqlSugar注入

2、类注入

3、接口注入

3、安装

Nuget: SqlSugar.IOC

用到 DbScoped.Sugar 的类库就需要引用 SqlSugarCore,否则不需要安装

4、用法

//注入SqlSugar对象
services.AddSqlSugar(new IocConfig()
{
                ConnectionString = "server=.;uid=sa;pwd=haosql;database=qq1",
                DbType = IocDbType.SqlServer,
                IsAutoCloseConnection = true
});

使用注入后SqlSugar对象

  public List<UserOrgMapping> GetMapping() 
  {
            List<UserOrgMapping> result=DbScoped.Sugar.Queryable<UserOrgMapping>()
                .Mapper(it => it.OrgInfo, it => it.OrgId)
                .Mapper(it => it.UserInfo, it => it.UserId)
                .ToList();
             DbScoped.Sugar.Deleteable<Student>().In(1).ExecuteCommand();
            return result;
  }

5.更多用法

http://www.donet5.com/Doc/10/2253

sqlsugar.ioc's People

Contributors

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