Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF DataService with Entity Framework: TimeSpan support
    primarykey
    data
    text
    <p>I am trying to create a WCF Data Service over an Entity Framework Object context that exposes a number of System.TimeSpan properties. However, when I try to access the service, I get the following error: 'The property 'ScheduledDepartureTime' on type 'DepotRoute' is of type 'Time' which is not a supported primitive type.'</p> <p>I have tried using DataServiceConfiguration.RegisterKnownType(typeof(TimeSpan)) as well as DataServiceConfiguration.EnableTypeAccess(typeof(TimeSpan).FullName) but neither of these seem to make any difference - I still get the error...</p> <pre><code>public static void InitializeService(DataServiceConfiguration config) { config.SetEntitySetAccessRule("*", EntitySetRights.AllRead); config.SetServiceOperationAccessRule("*", ServiceOperationRights.All); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; config.UseVerboseErrors = true; config.RegisterKnownType(typeof(TimeSpan)); config.EnableTypeAccess(typeof(TimeSpan).FullName); RouteTable.Routes.Add(new ServiceRoute("Data", new DataServiceHostFactory(), typeof(Data))); } </code></pre> <p>Although my context is being generated as a DbContext, I have overriden CreateDataSource to expose the ObjectContext rather than creating the service as DataService...</p> <pre><code>protected override ObjectContext CreateDataSource() { var context = new MercuryContext().ObjectContext; context.ContextOptions.ProxyCreationEnabled = false; return context; } </code></pre> <p>I have however also tried exposing a service based upon a standard EF Model but this too makes no difference. I have even tried it using VS11 Develop Preview - this too cannot expose my properties.</p> <p>What am I missing? There must be some way to do this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload