Lazyguy.Data.SqlSugar 1.0.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Lazyguy.Data.SqlSugar --version 1.0.1
                    
NuGet\Install-Package Lazyguy.Data.SqlSugar -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Lazyguy.Data.SqlSugar" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lazyguy.Data.SqlSugar" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Lazyguy.Data.SqlSugar" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Lazyguy.Data.SqlSugar --version 1.0.1
                    
#r "nuget: Lazyguy.Data.SqlSugar, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Lazyguy.Data.SqlSugar@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Lazyguy.Data.SqlSugar&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Lazyguy.Data.SqlSugar&version=1.0.1
                    
Install as a Cake Tool

Lazyguy.AspNetCore.Swagger


进击的码农:693137603(刚建的空群)


// 有默认值的均可不设置
{
  "LgSwaggerOptions": {
    "Title": "Net6项目Api文档",
    "UseToken": true, // Default true
    "RoutePrefix": "", // Default string.Empty
    "DisableMiniProfiler": false, // Default false
    "UseApiVersion": false, // Default false //TODO:感觉这里控制是否多版本不合适
    "Versions": // Default []
    [
      {
        "Version": "1.0",
        "Description": "版本1.0"
      },
      {
        "Version": "1.1",
        "Description": "版本1.1"
      }
    ]
  }
}


var builder = WebApplication.CreateBuilder(args);

builder.Services.AddLgSwagger(builder.Configuration); // 添加

var app = builder.Build();

app.UseLgSwagger(); // 添加


Lazyguy.Core

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddLgServices() // 服务注册:默认扫描所有程序集
public interface ITestService 
{
}
public class TestService : ITestService, ITransient 
{ 
}

Lazyguy.AspNetCore.Jwt

{
    "LgJwtOptions": {
        "Secret": "01234567890123456789",
        "Issuer": "wosperry.com",
        "Audience": "wosperry.com",
        "ExpireMinutes": 1
    },
}
builder.Services.AddLgJwt(builder.Configuration); // 注入 IJwtService 使用

Lazyguy.Data.SqlSugar

{
    "LgSqlSugarOptions": {
        "ConnectionString": "server=192.168.124.220;port=3306;userid=root;password=Aa123456.;database=sqlsugar_test;Charset=utf8;AllowLoadLocalInfile=true;",
        "DbType": 0,
    },
    /*
        连接字符串 https://www.donet5.com/home/Doc?typeId=1229
        0-Mysql: server=localhost;Database=SqlSugar4xTest;Uid=root;Pwd=haosql;
        1-SqlServer: server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST
        2-Sqlite: Data Source=xxx.db
        3-Oracle: server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST
        4-PostgreSQL: PORT=5432;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=haosql;USER ID=postgres
        5-Dm: Server=localhost; User Id=SYSDBA; PWD=SYSDBA;DATABASE=新DB
        5-Dm: PORT=5236;DATABASE=DAMENG;HOST=localhost;PASSWORD=SYSDBA;USER ID=SYSDBA
        6-Kdbndp: Server=127.0.0.1;Port=54321;UID=SYSTEM;PWD=system;database=SQLSUGAR4XTEST1
        7-Oscar: PORT=2003;DATABASE=osrdb;HOST=localhost;PASSWORD=szoscar55;USER ID=SYSDBA
    */
}
builder.Services.AddLgSqlSugar(builder.Configuration) // 配置了这个后,注入IRepository使用


// CodeFirst迁移数据库使用
// 实现了IEntity接口的实体类,才执行Migrate
app.UseLgSqlSugarMigrator();

实体:


// 必须要继承自IEntity
// 用法参考EFCore
// 必须有 Table Key Column,后面可能会加入默认值
[Table("t_book")]
public class Book:IEntity
{
    [Key]
    [Column("book_id")]
    [Comment("主键")]
    public int Id { get; set; }
    [Column("book_name")]
    [Comment("名字")]
    public string? Name { get; set; }
}

通用仓储:


// 注入 IRepository<Book> 即可操作数据,Book必须实现 IEntity


Lazyguy.Data.SqlSugar.StackExchange

{
    "LgSqlSugarOptions": {
        "ConnectionString": "server=192.168.124.220;port=3306;userid=root;password=Aa123456.;database=sqlsugar_test;Charset=utf8;AllowLoadLocalInfile=true;",
        "DbType": 0,
        "RedisConn":"192.168.124.220:6379,password=Aa123456."
    },
    /*
        连接字符串 https://www.donet5.com/home/Doc?typeId=1229
        0-Mysql: server=localhost;Database=SqlSugar4xTest;Uid=root;Pwd=haosql;
        1-SqlServer: server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST
        2-Sqlite: Data Source=xxx.db
        3-Oracle: server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST
        4-PostgreSQL: PORT=5432;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=haosql;USER ID=postgres
        5-Dm: Server=localhost; User Id=SYSDBA; PWD=SYSDBA;DATABASE=新DB
        5-Dm: PORT=5236;DATABASE=DAMENG;HOST=localhost;PASSWORD=SYSDBA;USER ID=SYSDBA
        6-Kdbndp: Server=127.0.0.1;Port=54321;UID=SYSTEM;PWD=system;database=SQLSUGAR4XTEST1
        7-Oscar: PORT=2003;DATABASE=osrdb;HOST=localhost;PASSWORD=szoscar55;USER ID=SYSDBA
    */
}
builder.Services.AddLgSqlSugarWithRedisCache(builder.Configuration) // 配置了这个后,注入IRepository使用


// CodeFirst迁移数据库使用
// 实现了IEntity接口的实体类,才执行Migrate
app.UseLgSqlSugarMigrator();

实体:


// 必须要继承自IEntity
// 用法参考EFCore
// 必须有 Table Key Column,后面可能会加入默认值
[Table("t_book")]
public class Book:IEntity
{
    [Key]
    [Column("book_id")]
    [Comment("主键")]
    public int Id { get; set; }
    [Column("book_name")]
    [Comment("名字")]
    public string? Name { get; set; }
}

通用仓储:


// 注入 IRepositoryWithCache<Book> 即可操作数据,Book必须实现 IEntity

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Lazyguy.Data.SqlSugar:

Package Downloads
Lazyguy.Data.SqlSugar.StackExchange

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0-pre4 352 1/8/2022
1.1.0-pre3 308 1/8/2022
1.1.0-pre2 313 1/7/2022
1.1.0-pre1 308 1/7/2022
1.0.1 1,283 1/6/2022