I have an EF CF model generated from .tt file so each entity gets an interface, say IEntity
.
Then I have a WCF Data Service exposing the model.
But when I add a service reference to this service, resulting entities have no such interface, so I can't use generics against them.
How can I workaround that?
Here is a detailed explanation why you do not get the IEntity on the client. If approach with sharing assembly does not work for you, you can still do the following. Instead of IEntity create EntityBase. Than add to this attributes like [KnownType(typeof(MyEntity1))], [KnownType(typeof(MyEntity2))]
and so on. You are using a tt, so you will be able twick it to generate EntityBase and knowntype attributes with all model types automatically. Than on the client you will get base class for all your entities.