Is there a way to set the context for your DataService in WCF Data Services? For example, say I have the following DataService:
public class MyDataService : DataService<MyContext>
Let’s say MyContext has an interface of IMyContext and I obtain an instance of this during a custom DataServiceHostFactory’s constructor by using Unity. So, I have this instance of the context and I have the method CreateServiceHost in the custom factory that I can override.
Is it possible to create an instance of the data service using the context I have obtained in this method or somewhere else?
I hope this makes sense.
Thanks
You can override the CreateDataSource method to be able to override the creation of the context class instance. http://msdn.microsoft.com/en-us/library/cc646746.aspx