Hi,
A question about using interfaces on presentationModels with RIA services.
It is possible to expose a object via Ria Services that implements an interface?
The interface:
public interface TestInterface
{
public int ID {get;set;}
}
We have a presentationModel :
public class TestPresentationModel : TestInterface
{
[Key]
public int ID {get;set;}
}
I now get a compilation error: The entity 'TestInterface' in DomainService 'SomeDomainService' does not have a key defined. Entities exposed by DomainService operations must have at least one public property marked with the KeyAttribute.
I tried to add a [Key] attribute, but then I get following error: The derived entity type 'TestPresentationModel' must be declared in a KnownTypeAttribute on the root entity 'TestInterface'.
I tried to add the [KnownTypeAttribute] attribute, but then I get following compilation error: Attribute 'KnownType' is not valid on this declaration type. It is only valid on 'class, struct' declarations.
It seems that Ria services tries to treat the interface as an entity? How can we overcome this problem?
Regards,
Stephane