public static Type GetIdEntity <TProperty>(string strTableName) { TypeBuilder typeBuilder = DynamicTypeHelper.BuildType("IdEntity", "Entitys", "SyncJob.Domain"); //定义构造器参数 Type[] ctorParams = new Type[] { typeof(string) }; object[] ctorParamValues = new object[] { $"`#Temp`{strTableName}" }; typeBuilder.AddAttribute <TableAttribute>(ctorParams, ctorParamValues); var id = typeBuilder.AddProperty <TProperty>("Id"); typeBuilder.AddCtor(new Type[] { typeof(TProperty) }, new FieldBuilder[] { id }); //return typeBuilder.CreateType(); return(null); }