mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
4.8.1
This commit is contained in:
parent
0abccebf83
commit
91b86efbea
39
Src/Asp.Net/SqlServerTest/Demos/H_ExtEntity.cs
Normal file
39
Src/Asp.Net/SqlServerTest/Demos/H_ExtEntity.cs
Normal 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; }
|
||||||
|
}
|
||||||
|
}
|
@ -52,6 +52,7 @@ namespace OrmTest
|
|||||||
Demo.QueryableView.Init();
|
Demo.QueryableView.Init();
|
||||||
Demo.AttributeDemo.Init();
|
Demo.AttributeDemo.Init();
|
||||||
Demo.Mapper.Init();
|
Demo.Mapper.Init();
|
||||||
|
Demo.ExtEntity.Init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Demos\F_VersionValidation.cs" />
|
<Compile Include="Demos\F_VersionValidation.cs" />
|
||||||
<Compile Include="Demos\G_Mapper.cs" />
|
<Compile Include="Demos\G_Mapper.cs" />
|
||||||
|
<Compile Include="Demos\H_ExtEntity.cs" />
|
||||||
<Compile Include="Models\CapitalEntity.cs" />
|
<Compile Include="Models\CapitalEntity.cs" />
|
||||||
<Compile Include="Config.cs" />
|
<Compile Include="Config.cs" />
|
||||||
<Compile Include="Demos\5_CodeFirst.cs" />
|
<Compile Include="Demos\5_CodeFirst.cs" />
|
||||||
|
@ -177,6 +177,9 @@ namespace SqlSugar
|
|||||||
if (golbalMappingInfo != null)
|
if (golbalMappingInfo != null)
|
||||||
column.IsIgnore = true;
|
column.IsIgnore = true;
|
||||||
}
|
}
|
||||||
|
if (this.Context.CurrentConnectionConfig.ConfigureExternalServices != null && this.Context.CurrentConnectionConfig.ConfigureExternalServices.EntityService != null) {
|
||||||
|
this.Context.CurrentConnectionConfig.ConfigureExternalServices.EntityService(property, column);
|
||||||
|
}
|
||||||
result.Columns.Add(column);
|
result.Columns.Add(column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
@ -90,5 +91,8 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public List<SqlFuncExternal> SqlFuncServices { get; set; }
|
public List<SqlFuncExternal> SqlFuncServices { get; set; }
|
||||||
public List<KeyValuePair<string, CSharpDataType>> AppendDataReaderTypeMappings { get; set; }
|
public List<KeyValuePair<string, CSharpDataType>> AppendDataReaderTypeMappings { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public Action<PropertyInfo, EntityColumnInfo> EntityService{ get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("4.8")]
|
[assembly: AssemblyVersion("4.8.1")]
|
||||||
[assembly: AssemblyFileVersion("4.8")]
|
[assembly: AssemblyFileVersion("4.8.1")]
|
||||||
|
Loading…
Reference in New Issue
Block a user