Object Orientation and Detatiating Objects

When creating a web application that uses an entity infrastructure at the data access level, it is recommended that objects be separated from the object context so that objects can be garbage collected.

But since web applications are all requests β†’ responder applications, the object context itself no longer refers to any living objects after sending a response to the client, therefore the object context and its attached object should be accessible for garbage collection, since there is no living object referring to any of them.

Am I missing something or disconnecting objects in this case is not necessary?

+5
source share
5 answers

, , ,

.

, , .

:

var source = ctx.Staff;
source.MergeOption == MergeOption.NoTracking;

var staff = (from s in source
             where s.ID == 12 
             select s).First();

. . , as, , entites, .

: , , .

, , , .

,

PS: ObjectContext .

+2

, EF, Linq-to-SQL, . , . , (n-). EF.

0

, , . EF NHibernate / ( Windows). , 1, . , , - - , NHibernate, -.

, , . , , , .

0

EF, , , n- , entityCollection, . asp.net

0

, ( - ), , . .

, , - .

0
source

All Articles