sunkaixuan
2 years ago
4 changed files with 69 additions and 19 deletions
@ -0,0 +1,30 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Reflection.Emit; |
|||
using System.Reflection; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace SqlSugar |
|||
{ |
|||
|
|||
public class DynamicProperyBuilder |
|||
{ |
|||
public DynamicBuilder baseBuilder; |
|||
public DynamicProperyBuilder CreateProperty(string propertyName, Type properyType, SugarColumn table) |
|||
{ |
|||
PropertyMetadata addItem = new PropertyMetadata(); |
|||
addItem.Name = propertyName; |
|||
addItem.Type = properyType; |
|||
addItem.CustomAttributes = new List<CustomAttributeBuilder>() { baseBuilder.GetProperty(table) }; |
|||
baseBuilder.propertyAttr.Add(addItem); |
|||
return this; |
|||
} |
|||
|
|||
public Type BuilderType() |
|||
{ |
|||
return DynamicBuilderHelper.CreateDynamicClass(baseBuilder.entityName, baseBuilder.propertyAttr, TypeAttributes.Public, baseBuilder.entityAttr, baseBuilder.baseType, baseBuilder.interfaces); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue