这是我希望生成的类声明的样子:
public sealed partial class Refund : DataObjectBase<Refund>
{
}
}
此代码(片段):
targetClass = new CodeTypeDeclaration(className);
targetClass.IsClass = true;
targetClass.TypeAttributes =
TypeAttributes.Public | TypeAttributes.Sealed;
targetClass.IsPartial = true; //partial so that genn'ed code can be safely modified
targetClass.TypeParameters.Add(new CodeTypeParameter{ Name=className});
targetClass.BaseTypes.Add(new CodeTypeReference { BaseType = "DataObjectBase", Options = CodeTypeReferenceOptions.GenericTypeParameter });
生成此类声明:
public sealed partial class Refund<Refund> : DataObjectBase
{
}
我究竟做错了什么?
我认为 BaseType 的以下字符串应该可以解决问题(未经测试):
"DataObjectBase`1[[Refund]]"
您可能需要提供一个完全限定的名称Refund
,至少包括程序集名称:
"DataObjectBase`1[[Refund, RefundAssembly]]"
然后你应该删除该行targetClass.TypeParameters.Add(...)
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)