为什么 edmx 图不创建数据注释
我开始意识到,当我绘制模型或从数据库生成模型时,Key
或 Required
的注释并未设置,尽管模型中的注释看起来像例如,身份属性就是这样绘制的。有什么问题吗?我需要更改 edmx 文件中的一些配置吗???
I'm started to realized that when I draw a Model or generated a model from data base the annotations of Key
or Required
are not setting despite that in the model appears like for example the attributes wich are identity are painted like that. It's something wrong? do i need to change some configurations in the edmx file???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这并没有错。简单来说,EDMX 就是映射,与验证属性无关。 EDMX 本身也不生成代码。这是自定义工具或 T4 模板的责任。这些生成器的默认实现不使用数据注释。您必须通过伙伴类手动添加它们或修改 T4 模板来生成它们。
No it is not wrong. Simply EDMX is mapping and it has nothing to do with validation attributes. EDMX itself also doesn't generate code. It is responsibility either of custom tool or T4 template. Default implementations of these generators don't use data annotations. You must either add them manually through buddy classes or modify T4 template to generate them.