c# - Issues with Entity Framework Self Tracking Entities and ASP MVC .NET and Managed Extensibility Framework -
Large editing: This problem is probably being done by MEF!
I am using a service oriented architecture and work through all my MVC control services.
I have a basic service that looks like this:
public abstract class BaseService {MyObjectModel reference protected; Public base service () {reference = new MyObjectModel (); }} I have the services that warrant
[export (typef (IEP service)) Public class employee service: base service, IEPP service (Public Zero NewPierry) employee new employees) {context.Employees.AddObject (newEmployee); Context.SaveChanges (); }} I have also received my controller from a base class that provides access to all the necessary services so that they can call:
employee Service. Additional employee (new employee () {name = "JohnDoe"}); All of this worked brilliantly until I did not see that ObjectContext was not accurately reflecting the database on construction.
I put a breakpoint in the BaseService constructor and the profiler of Sql server saw that the brand new MyObjectModel was not even killing DB, but had some estimates of pulling out cache data?
I stumbled on the merge operation property of the archive and changed to ensure that the data was fresh, but now I need to use it that every time I create a new service system, Returns to!
Edit: Until I realized that the reasons for my issues might probably be MEF
I have overridden the default controller factor and used MEF to speed up the services One has to implement. Do I see living things between MEF calls
then
1) Where can I read more on this behavior?
thanks
public class controller Factory:
IC Controller Factor {Composition Container Container; Default Controller Feature Controller Factor; Public Controller (Container = New Composition Editor (Assembly of the new Assembly (Assembly; Gate-Accpiring Assembly)); Controller Factory = New DefaultControllerFactory ();} Public IController CreateController (System.Web.Routing.RequestContext requestContext, string control name ) {Var Controller = Controller Factor.CreateController (requestContext, ControllerName); container.ComposeParts (Controller); Return Controller;} Public Zero Release Controller (IC Controller Controller) {var IDisposable as Disposable = Controller; if (D I have called this line in my application startup.
Control Builder. Current .Contactor Factor (New Controller Fitter);
What was happening was that the controller factory was only being launched after the Appdomain cycle and hence my structure container was as good. Squares were not specifically marked for shared or non-shared use Therefore, the container was organized in the context of each and every time the controller Fantasy has made a new controller on each call, it will populate the service properties with references placed from those old contexts, including the old objecttontex, whose The result is mismatched in the data
Was resolved.
Now I wonder if the MEF is still holding on the same references, because there is no small matter to catch that object contests. Is this a memory leak waiting to happen?
Comments
Post a Comment