是否有可能获得动态类型的设计时代码完成?
我正在研究动态生成类型,即。 TypeBuilder
、Reflection.Emit
.. 是否有可能为此类创建的类型获得设计时代码完成?即类型名称识别、输入“obj1.
”后的属性列表等。
完整上下文:尝试在运行时生成与数据库表相对应的实体和数据访问对象。代码生成是一个选项,但我想看看是否可以不使用它。有一些反射方面的经验,但没有构建反射.emit 方式的类型经验。
I'm looking into generating types dynamically, ie. TypeBuilder
, Reflection.Emit
..
Is it ever possible to get design-time code completion for such created types? i.e typename recognition, list of properties after typing "obj1.
" and such.
Full Context: Trying to generate entities and data access objects corresponding to database tables in runtime. Code generation is an option, but I wanted to see if I could do without it. Have some experience in reflection, but none in type building the reflection.emit way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有认真的设计师魔力,这是不可能的。发出的代码直到运行时才真正生成,这意味着它在设计时实际上不可用。您可以使用 T4 模板以这种方式生成类型,因为设计人员将评估模板以构建所需的类型,当然这些类型在设计时立即可用。
Not likely without some serious designer mojo. Emitted code isn't actually generated until runtime, which means it's not actually available at design time. You could use T4 templates to generate your types that way, as the designer will evaluate the templates to build the required types, which of course are immediately available at design time.