获取好友班级信息?
我正在尝试读取好友类元数据信息,以便在正常的 asp.net mvc 2 验证过程之外使用。我认为这就像说一样简单:
DataAnnotationsModelMetadataProvider metadataProvider = new DataAnnotationsModelMetadataProvider();
var metaData = metadataProvider.GetMetadataForType(() => new T(), typeof (T));
这有效,但返回的是整个类型元数据信息,而不仅仅是好友信息中的内容。根据 MVC2 源代码(它使用 DataAnnotations 的好友类支持),它应该支持获取好友数据信息,但我没有看到代码中反映到 Metadatatype() 属性的部分。
这里一般都比较混乱。我是否错过了超载或其他什么?
I'm trying to read buddy class metadata information for usage outside of the normal asp.net mvc 2 validation process. I thought it would be as simple as saying:
DataAnnotationsModelMetadataProvider metadataProvider = new DataAnnotationsModelMetadataProvider();
var metaData = metadataProvider.GetMetadataForType(() => new T(), typeof (T));
That works, but is returning me the entire types metadata information and not just what is in the buddy information. According to the MVC2 source ( It uses the buddy class support from DataAnnotations, ) it should support getting the buddy data information but I don't see the part in the code where it reflects into the Metadatatype() attribute.
Generally confused here. Did I miss an overload or something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也有同样的问题。我已经看过 30 到 40 个关于为什么这个实体框架“数据库优先”部分类不起作用的教程。然后我找到了这篇文章 - MVC 4 EF5数据库首先在部分类中设置默认值——给出了以下建议:
I had the same problem. I have looked at literally 30 maybe 40 tutorials about why this Entity Framework "Database First" partial classes wasn't working. Then I found this post -- MVC 4 EF5 Database First set Default Values in Partial Class -- that gave the following suggestion: