Browse Source

Update Demo

pull/1/head
skx 4 years ago
parent
commit
d39bfb1626
  1. 1
      Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
  2. 46
      Src/Asp.Net/SqlServerTest/_OldTest/BugTest/Bug4.cs

1
Src/Asp.Net/SqlServerTest/SqlServerTest.csproj

@ -79,6 +79,7 @@
<Compile Include="Models\ViewOrder.cs" />
<Compile Include="UnitTest\UQueue.cs" />
<Compile Include="_OldTest\BugTest\Bug2.cs" />
<Compile Include="_OldTest\BugTest\Bug4.cs" />
<Compile Include="_OldTest\BugTest\BugModels\AccountsModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\ClientsModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\ExposureModel.cs" />

46
Src/Asp.Net/SqlServerTest/_OldTest/BugTest/Bug4.cs

@ -0,0 +1,46 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest.Test
{
public class BugTest4
{
public static void Init()
{
SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = Config.ConnectionString,
DbType = DbType.SqlServer,
IsAutoCloseConnection = true,
//MoreSettings = new ConnMoreSettings()
//{
// PgSqlIsAutoToLower = true //我们这里需要设置为false
//},
InitKeyType = InitKeyType.Attribute,
});
//调式代码 用来打印SQL
Db.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine(sql);
};
Db.CodeFirst.InitTables(typeof(Testmmm));
Db.Insertable(new Testmmm() { b = "a" }).InsertColumns(it => new { it.b}).ExecuteCommand();
var list = Db.Queryable<Testmmm>().ToList();
}
public class Testmmm {
[SugarColumn(IsIdentity =true,IsPrimaryKey =true)]
public int id { get; set; }
[SugarColumn(ColumnDataType ="nvarchar",Length =8, DefaultValue ="222", ColumnDescription ="aa")]
public string a { get; set; }
public string b { get; set; }
}
}
}
Loading…
Cancel
Save