This commit is contained in:
sunkaixuan
2018-10-16 08:49:59 +08:00
parent 0abccebf83
commit 91b86efbea
6 changed files with 50 additions and 2 deletions

View File

@@ -0,0 +1,39 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OrmTest.Demo
{
public class ExtEntity: DemoBase
{
public static void Init()
{
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() {
ConnectionString = Config.ConnectionString,
DbType = DbType.SqlServer,
IsAutoCloseConnection = true,
ConfigureExternalServices=new ConfigureExternalServices() {
EntityService = (property, column) => {
if (property.Name == "xxx") {
column.IsIgnore = true;
}
//property.GetCustomAttributes
}
}
});
var sql=db.Queryable<StudentTest>().ToSql();
var sql2 = db.Insertable<StudentTest>(new StudentTest()).ToSql();
}
}
public class StudentTest {
public string Id { get; set; }
public string xxx { get; set; }
public string Name { get; set; }
}
}

View File

@@ -52,6 +52,7 @@ namespace OrmTest
Demo.QueryableView.Init();
Demo.AttributeDemo.Init();
Demo.Mapper.Init();
Demo.ExtEntity.Init();
}
}
}

View File

@@ -49,6 +49,7 @@
<ItemGroup>
<Compile Include="Demos\F_VersionValidation.cs" />
<Compile Include="Demos\G_Mapper.cs" />
<Compile Include="Demos\H_ExtEntity.cs" />
<Compile Include="Models\CapitalEntity.cs" />
<Compile Include="Config.cs" />
<Compile Include="Demos\5_CodeFirst.cs" />