none
Getting 'Unable to load metadata' while trying return custom class object in webget method of OData service. RRS feed

  • General discussion

  • We have WCF data service( OData service) on top of entity framework( edmx) and have written some custom operation in the wcf data service to implement some business logic. We are able to access these custom service operations along with edmx entities. But when we try to add a service operation which return custom class object which is not part of entity context( edmx), then we are facing an issue "unable to load metadata". We have tried different approaches to manually set datacontract attibute, dataservice key on the custom class and adding manually that entity as "public virtual DbSet<customclass> customlist{ get; set; }" to dbcontext but we are facing below issue:

    "The server encountered an error processing the request. The exception message is 'Unable to load metadata for return type 'System.Linq.IQueryable`1[Entities.tblUser]' of method 'System.Linq.IQueryable`1[Entities.tblUser] GetUser(System.String, System.String)'."

    We are using MaxDataProtocolVersion.V3 in wcf data service and entity framework 6.0

    Please let us know whether custom class object return type is supported in WCF data service or not?

    Wednesday, August 31, 2016 10:10 AM