mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
调整CodeFirst扩展方法
This commit is contained in:
parent
39feb64646
commit
c012c166d8
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using FreeSql.DataAnnotations;
|
||||
using FreeSql.Internal;
|
||||
@ -7,7 +8,6 @@ using FreeSql.Internal;
|
||||
namespace FreeSql.Extensions
|
||||
{
|
||||
#if net40 || NETSTANDARD2_0
|
||||
//不支持
|
||||
#else
|
||||
public static class CodeFirstExtensions
|
||||
{
|
||||
@ -15,22 +15,12 @@ namespace FreeSql.Extensions
|
||||
/// 动态构建Class Type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DynamicCompileBuilder DynamicEntity(this ICodeFirst codeFirst, string className, TableAttribute tableAttribute)
|
||||
public static DynamicCompileBuilder DynamicEntity(this ICodeFirst codeFirst, string className,
|
||||
TableAttribute tableAttribute)
|
||||
{
|
||||
return new DynamicCompileBuilder().SetClass(className, tableAttribute);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据动态构建的Class Type生成实例并进行属性赋值
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="porpertys"></param>
|
||||
/// <returns></returns>
|
||||
public static object CreateDynamicEntityInstance(this Type type,
|
||||
Dictionary<string, object> porpertys)
|
||||
{
|
||||
return DynamicCompileBuilder.CreateObjectByType(type, porpertys);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user