In my project, I use a Data Service that uses EF. Now I have a custom class that I also want to open through my data service, but I can not get it to work, it seems that it is impossible to mix custom types and EF in a single data service. Any suggestions?
It does not seem to find any information in the metadata.
Error:
The server detected an error processing the request. The exception is the message "Unable to load metadata for the return type" System.Linq.IQueryable 1[ITS.NetProject.Model.CustomEnty]' of method 'System.Linq.IQueryable 1 [ITS.NetProject.Model.CustomEnty] GetCustomEnties () ''. View Server Logs More details. Exception stack trace: ....
Code:
[ServiceBehavior(IncludeExceptionDetailInFaults=true)] public class ITSServiceOData : DataService<ITSEntities> { public static void InitializeService(DataServiceConfiguration config) { config.SetEntitySetAccessRule("*", EntitySetRights.All); config.SetServiceOperationAccessRule("GetCustomEnties", ServiceOperationRights.AllRead); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } [WebGet] public IQueryable<CustomEnty> GetCustomEnties() { return from e in this.CurrentDataSource.CustomEnties select e; } }
source share