To solve the dependency on my data model, I created a data service and using the AutoFax WCF integration, I ran into a problem have taken. Registration forms are:
Builder. Registration Type & lt; MyService & gt; (). Dependency on the shelf (); Builder. Registration Type & lt; MyModel & gt; (). InstancePerLifetimeScope ();
Where MyModel has a dependency on MyProvider
Public MyModel (MyProvider Provider) {_provider = provider; }
The problem arises because this provider is registered in the area of request for appropriate reasons for my application.
builder.RegisterType & lt; MyProvider & gt; (). & Lt; MyProver & gt; (). InstancePier Matching Lifetime Scope (RequestContentag); As can be obvious, the request container is created and settled on each ASP.NET request. However, MyModel and MyService are registered within the scope of the application. I have come up with two possible solutions -
- Changing the provider's scope (not possible because almost the whole app will need to be reproduced)
- Service Scope Register the model (do not know if this is possible and if it is right)
Thanks for any advice / suggestions.
I find "registered in the request area" with your statement that you think the ASP.NET "request" scope As configured by containerproduct
? (Please do not specify.)
The request lifetime is only seen by ASP.NET requests, and no WCF request - WCF uses a different pipeline.
Perhaps one way to get what you want, please post some details of MyProvider
registration.
Ensure that your per-demand component does not depend on any ASP.NET "HTTP" types
Hope this helps!
Nick
Comments
Post a Comment