a large model has hundreds of entities instantiate overhead momery cost each time?

Answered a large model has hundreds of entities instantiate overhead momery cost each time?

  • Monday, April 16, 2012 6:23 AM
     
     

    hi.

    i have a entity model that have hundreds of entities.

    when use using(objectcontext) statement to start work that only use little some ObjectSet properties

    the rest ObjectSet Type Properties is still allocate memory to them even if these Properties is null reference?

    in my X64 OS, at least 8 byte for a pointer. 1000 properties would used 8k memory per call session to instantiate a new ObjectContext

    maybe ,those largely properties is never used in that call session.

    somebody can clear me?

    is there like DependencyProperty pattern for the ObjectContext.ObjectSet Properties.?

    thanks a lot.


    DON'T TRY SO HARD,THE BEST THINGS COME WHEN YOU LEAST EXPECT THEM TO.


    • Edited by Matthew LIN Monday, April 16, 2012 6:44 AM
    •  

All Replies

  • Monday, April 16, 2012 9:35 AM
     
     

    Hi,

    AFAIK no. Do you have actually seen an issue ? Do you have tried to use a memory profiler to see if you are not consuming much more memory in another area ? It's likely best to make sure what is the real problem before trying to apply a solution.


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

  • Tuesday, April 17, 2012 2:03 AM
    Moderator
     
     

    Hi Matthew LIN,

    Welcome to MSDN Forum.

    Using entitiy framework with too many entities, you can split the entities into multiple EDMX file, but in this way, you have to take care of synchronizing.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

  • Wednesday, April 18, 2012 12:34 PM
     
     

    may i disable generating ObjectSet<> something property ? and then in using(new objectcontext) statement, i declare variable to return value of CreateObjectSet method where i need ?


    DON'T TRY SO HARD,THE BEST THINGS COME WHEN YOU LEAST EXPECT THEM TO.

  • Wednesday, April 18, 2012 1:15 PM
     
     Answered

    It won't save the space needed to store the backing fields. It saves the space used for the object instances themselves but this is likely already the case. You could also handle all dynamically but it defeats the purpose and would be counter productive.

    It' s easier to help when knowing your issue. The goal is to make sure which problem you are trying to solve or if you are just thinking it could have some benefit (and perhaps realize after having done that, that it has no usefull benefit at all).


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".