Using ASP.NET MVC, Linq To SQL, and StructureMap causing DataContext to cache data?

"YOU AND THE ART OF ONLINE DATING" is the only product on the market that will take you step-by-step through the process of online dating, provide you with the resources to help ensure success. Get it now!

Got this response back from Jeremy Miller on the StructureMap google group: Easy money, you're creating an instance of your DataContext object -yourself- in the registration, which de facto makes that a singleton throughout the StructureMap ecosystem This code: Data Connections. For(Of DCSDataContext)() _ . HybridHttpOrThreadLocalScoped _ .

Use(New DCSDataContext()) Needs to define the DataContext using -deferred- execution rather than using the pre-built "New DCSDataContext() If you were in C# (because I don't know the VB syntax), you would do: For(). HybridHttpOrThreadLocalScoped(). Use(() => new DCSDataContext()) I ran this through a C# to VB converter and it gave me this: For(Of DCSDataContext)() _ .

HybridHttpOrThreadLocalScoped _ . Use(Function() New DCSDataContext()) Which works great!

Got this response back from Jeremy Miller on the StructureMap google group: Easy money, you're creating an instance of your DataContext object -yourself- in the registration, which de facto makes that a singleton throughout the StructureMap ecosystem. This code: 'Data Connections. For(Of DCSDataContext)() _ .

HybridHttpOrThreadLocalScoped _ . Use(New DCSDataContext()) Needs to define the DataContext using -deferred- execution rather than using the pre-built "New DCSDataContext()" If you were in C# (because I don't know the VB syntax), you would do: For(). HybridHttpOrThreadLocalScoped().

Use(() => new DCSDataContext()); I ran this through a C# to VB converter and it gave me this: For(Of DCSDataContext)() _ . HybridHttpOrThreadLocalScoped _ . Use(Function() New DCSDataContext()) Which works great!

How do I give parameter to () => new DCSDataContext(parameter), I want the creation of paramater is auto wired,I don't want to create and give manually – Sessiz Saat Dec 6 '10 at 12:27 @Sessiz Satt: I had done this with the connection string property. I had pulled my connection string property from the Web. Config file and passed it like this ... ()=>new DCSDataContext(ConfigurationManager.

AppSettings"Key") – Dragn1821 Dec 13 '10 at 18:56.

Data, and DCS.Services. Here is the DCS. Everything works great as far as loading the dependecies, but I'm having problems with the DCSDataContext class that was genereated by Linq2SQL Classes.

I have a form that posts to a details page (/Summary/Details), which loads in some data from SQL. I then have a button that opens a dialog box in JQuery, which populates the dialog from a request to (/Operator/Modify). On the dialog box, the form has a combo box and an OK button that lets the user change the operator's name.

Upon clicking OK, the form is posted to (/Operator/Modify) and sent through the service and repository layers of my program and updates the record in the database. Then, the RedirectToAction is called to send the user back to the details page (/Summary/Details) where there is a call to pull the data from SQL again, updating the details view. Everything works great, except the details view does not show the new operator that was selected.

I can step through the code and see the DCSDataContext class being accessed to update the operator (which does actually change the database record), but when the DCSDataContext is accessed to reload the details objects, it pulls in the old value. I'm guessing that StructureMap is causing not only the DCSDataContext class but also the data to be cached? I have also tried adding the following to the Global.

Can someone please help?

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.

Related Questions