zoukankan      html  css  js  c++  java
  • Entities exposed by DomainService operations must have at least one public property marked with the KeyAttribute

    使用ado.net entity framework从存储过程生成复杂类型实体类, 然后使用WCF ria service将实体类想客户端暴露。编译过程中产生一个错误,

    The entity '实体类' in DomainService 'wcf ria 服务' does not have a key defined. Entities exposed by DomainService operations must have at least one public property marked with the KeyAttribute

    产生这个错误是因为 ado.net entity framework从存储过程生成复杂类型实体类中没有主键,给实体类中得某个字段手动加上

    [System.ComponentModel.DataAnnotations.KeyAttribute]这个特性就好了。

    我觉得这算是ado.net entity framework的一个BUG吧,应该让我们生成复杂类型实体类的时候可以设置主键。不知道微软以后会不会改进。

  • 相关阅读:
    javaweb:Filter过滤器
    javaScript:高级
    javascript:基础
    Boostrao:轮播图
    Bootstrap案列:首页界面
    Bootstrap学习笔记
    javaweb:respone
    javaweb:jsp
    五、结构型模式--->07.享元模式
    五、结构型模式--->06.组合模式
  • 原文地址:https://www.cnblogs.com/yuilin/p/2135362.html
Copyright © 2011-2022 走看看