C# 中的类定义复制生成
我有一个从 dynamcis crm 代码生成工具的早期绑定类创建的程序集 (DLL)。这些类大多具有属性。
我想使用这些类作为具有额外控制的模型。
就像在java中一样,期待使用反射,但找不到它的示例或使用FxCop进行内省
我尝试使用T4工具箱(装饰器类 - 此处),但不支持属性。 我也尝试过像 CodeSmith 这样的工具,但不知道这是否可行。
我期待 Visual Studio 或其扩展应该可以轻松做到这一点。
原始类
public class Product {
public Guid Id { get; set; }
}
生成的类
public class ProducModel {
public Guid Id { get; set; }
}
可维护性:如果原始类发生变化,您建议的工具/方法可以处理吗?
有什么建议吗?
I have an assembly (DLL) created from the Early bound classes of dynamcis crm's code genaration tool. These classes mostly have properties.
I want to use these classes as Model with additional control.
Like in java, is was looking forward to use reflection, but could not find example on it or introspection using FxCop
I tried using T4 toolbox (Decorator classes - here) but that does not support Properties.
I also tried tools like CodeSmith but could not figure out if that is possible.
I was expecting Visual Studio or its extenstion should be easily do it.
Original Class
public class Product {
public Guid Id { get; set; }
}
Generated class
public class ProducModel {
public Guid Id { get; set; }
}
Maintainibility: If original class changes, would your suggested tool/method cope with that?
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终使用了 Visual Studio & 的“转到定义”(F12) 功能。复制/粘贴所需的属性。
MS 论坛上的详细答案
I ended up using "Go to Definition" (F12) feature of visual studio & copy/pasting the required properties.
Detailed answer on MS Forum