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

  • Question

  • 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:12 AM

All replies

  • Hi Anusha,

    Based on your description, your issue is related with WCF Data service, I will move this thread to the more related with forum.

    Reference: http://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetdataservices

    Thanks for your understanding.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, September 1, 2016 5:09 AM