I'm trying to expose my entity model as an OData service,
following your instructions. However, when I got to the "Calling your service" part, I got a "Request Error" instead of the proper response. I enabled debugging output, and found that it is caused by some TimeSpan properties on one of my entities, resulting in an error like the following:
The property 'InTime' on type 'My.DataModel.Schedule' is not a valid property. Make sure that the type of the property is a public type and a supported primitive type or a entity type with a valid key or a complex type.
Fair enough. I figured I'd hide these from the DataService using the IgnorePropertiesAttribute on my entity and expose them as something else (such as Ticks) using a calculated property. Thus I created a partial class implementation of my class, like so:
[IgnoreProperties( @"InTime", @"OutTime" )]
partial class Schedule
{
// TODO: Implement calculated In-/OutTime properties
}
However, when I attempt to compile this, I get this error:
Duplicate 'IgnoreProperties' attribute
Looking at the generated Schedule class, it already has an IgnorePropertiesAttribute, like this:
[IgnoreProperties(@"EntityAspect")]
public partial class Schedule : IbEm.Entity {
}
So, what do I do? Can I hook into the IgnoreProperties generation by just setting a property in the EDMX file, or is there some other way I have to do this?