Browse Source

-

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
57ef4c1b0e
  1. 40
      Src/Asp.Net/SqlServerTest/Demo/DemoD_DbFirst.cs
  2. 1
      Src/Asp.Net/SqlServerTest/Program.cs
  3. 1
      Src/Asp.Net/SqlServerTest/SqlServerTest.csproj

40
Src/Asp.Net/SqlServerTest/Demo/DemoD_DbFirst.cs

@ -0,0 +1,40 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OrmTest
{
public class DemoD_DbFirst
{
public static void Init()
{
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.SqlServer,
ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
AopEvents = new AopEvents
{
OnLogExecuting = (sql, p) =>
{
Console.WriteLine(sql);
}
}
});
db.DbFirst.CreateClassFile("c:\\Demo\\1", "Models");
db.DbFirst.Where("Student").CreateClassFile("c:\\Demo\\2", "Models");
db.DbFirst.Where(it => it.ToLower().StartsWith("view")).CreateClassFile("c:\\Demo\\3");
db.DbFirst.Where(it => it.ToLower().StartsWith("view")).CreateClassFile("c:\\Demo\\4");
}
}
}

1
Src/Asp.Net/SqlServerTest/Program.cs

@ -12,6 +12,7 @@ namespace OrmTest
Demo1_SqlSugarClient.Init();
Democ_GobalFilter.Init();
DemoD_DbFirst.Init();
Console.WriteLine("all successfully.");
Console.ReadKey();

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

@ -51,6 +51,7 @@
<ItemGroup>
<Compile Include="Demo\Democ_GobalFilter.cs" />
<Compile Include="Demo\Demo2_Queryable.cs" />
<Compile Include="Demo\DemoD_DbFirst.cs" />
<Compile Include="Models\MyCustomAttributeTable.cs" />
<Compile Include="Models\Order.cs" />
<Compile Include="Models\OrderItem.cs" />

Loading…
Cancel
Save