mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Dynamically constructed class attributes can be of this class
This commit is contained in:
@@ -24,7 +24,16 @@ namespace SqlSugar
|
||||
|
||||
foreach (PropertyMetadata property in properties)
|
||||
{
|
||||
EmitTool.CreateProperty(typeBuilder, property.Name, property.Type, property.CustomAttributes);
|
||||
var type = property.Type;
|
||||
if (type == typeof(DynamicOneselfType))
|
||||
{
|
||||
type = typeBuilder;
|
||||
}
|
||||
else if (type == typeof(DynamicOneselfTypeList))
|
||||
{
|
||||
type = typeof(List<>).MakeGenericType(typeBuilder);
|
||||
}
|
||||
EmitTool.CreateProperty(typeBuilder, property.Name, type, property.CustomAttributes);
|
||||
}
|
||||
|
||||
Type dynamicType = typeBuilder.CreateTypeInfo().AsType();
|
||||
|
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
/// <summary>
|
||||
/// Dynamically construct Type, the property is self, with this type
|
||||
/// </summary>
|
||||
public class DynamicOneselfType
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Dynamically construct Type, the property is List self , with this type
|
||||
/// </summary>
|
||||
public class DynamicOneselfTypeList
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user