.net - Difference between NHibernate SessionFactory and EF 4.0 ObjectContext -


The NHibernate is called a heavy object in SessionFactory and it is suggested that the SessionFactory application should be created once in the life span.

However, once we handle the sensor, we will call it open () before performing any of the DB operations. Are there.

In EntityFramework we need every object object projection before doing any work with the built-in store. There is no such opening in the case of EF.

My question is:

Is making a reference in EF similar to opening session features in NHibernate?

or Should I create an ObjectContext once in the application life period and share it? Update: I found the following links to manage the objectivity of a contact life, although the author of that link has been mentioned:

< However, you should not use a static object syntax in an ASP.NET application, since the stable members have a single HTTP request they are actually bound to the age of AppDomain Are, which can be minutes or hours In Astw, members of static class Aspiknet is also shared between multiple threads and user applications. Using the same object contact instance from multiple threads can cause serious problems simultaneously.

But in NHibernate, we do the exact same thing, we create a session factory as a stable field and then use the same frequency again and again.

What is suggested in the form of wrong practice in case of unit structure?

In the EF, the OC session is more like a session in the NH compared to session transmission.


Comments