If not, then that's the problem. In order for a class to be recognized as an entity it must be exposed in an entity set (have a property on the Context class) and it must have a key (either heuristics or DataServiceKey attribute) Also note, that it seems you're defining a reflection based service over an EF based data store. This will have problems with more complex queries.
WCF DS generates somewhat different expression trees for reflection provider versus EF provider (necessary due to the space of valid expressions supported by these). The trees generated for reflection provider are not always compatible with EF (and the other way round) If you could share more of your Context class, maybe there's a way to do this without forcing the usage of reflection provider. I understand that you expose several DBs over the service, but how do you run which DB to run the incomming request against?
If it can be determined by looking at the request alone, and each request can run only on a single DB, then I think just a bit of logic inside the CreateDataSource should be enough.
If not, then that's the problem. In order for a class to be recognized as an entity it must be exposed in an entity set (have a property on the Context class) and it must have a key (either heuristics or DataServiceKey attribute). Also note, that it seems you're defining a reflection based service over an EF based data store.
This will have problems with more complex queries. WCF DS generates somewhat different expression trees for reflection provider versus EF provider (necessary due to the space of valid expressions supported by these). The trees generated for reflection provider are not always compatible with EF (and the other way round).
If you could share more of your Context class, maybe there's a way to do this without forcing the usage of reflection provider. I understand that you expose several DBs over the service, but how do you run which DB to run the incomming request against? If it can be determined by looking at the request alone, and each request can run only on a single DB, then I think just a bit of logic inside the CreateDataSource should be enough.
Thank you for your answer. There is one parameter which defines which database should be queried. This parameter must be contained in every request.In the moment, it is a query parameter (?gac=0), but I can set also a header containing this value...I have the control over both the client and the WCF DS.
I will try to explore the CreateDataSource method-I would like to create a connection to the corresponding EF data store o demand - means to explore the request, pick the corresponding parameter (called 'gac') and create the data source. I will let you know if it worked. – Tomas Walek Nov 28 at 8:20 So I updated the service definition.
The property exposed in the context class is of type IQuerable (see "CustomContext. Gac"). The corresponding class "Gac" also has a data service key defined ("GacId").
– Tomas Walek Nov 29 at 7:56 But you will need IQueryable property on the context class. For a type to be correctly recognized as entity type it must have a key property and it must have an IQueryable property on the context. – Vitek Karas MSFT Nov 29 at 10:24 This was the missing piece of the puzzle!
I somehow misinterpreted your previous answer. So there must be really a IQueryable property for each property which should be recognized as an entity, even though the access to this property does not make any sense and will throw an exception (as in my case). – Tomas Walek 2 days ago If it throws then the protocol will be broken.
The property on the context (which defines an entity set) is used to generate unique links for each instance. OData currently doesn't support containment, that is entities which can only exist as children of some parent entity. You can see the "broken" piece by navigating to one of those entities and see its self link.
That needs to be always valid URL, but if your top-level property throws, the link will fail. This also means that WCF DS client won't be able to update those entities (since it uses self/edit link to do so). – Vitek Karas MSFT 2 days ago.
I don't think you can expose generics to web services. As a general rule I wouldn't expose ADO. Net data entities to a web service.
You should abstract out your data classes from your web service code.
But this is the purpose of WCF Data Services...I need this functionality of exposing ADO. NET data to a web service. – Tomas Walek Nov 21 at 15:00.
I think that WCF tries to serialize TransactionList property. You can put attribute which tells WCF to skip property (something like IgnoreDataMember) or convert that property to method GetTransationList().
Actually I need this property, so I cannot skip it so simply. And I want to avoid using service operations here as there are a lot of database views and I would need a service operation for each database view. – Tomas Walek Nov 21 at 15:24.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.