locked
CreateObject() and AddObject() RRS feed

  • Question

  • Hi guys,

     

    just a quick poco question, setup is EF4, POCO objects, ProxyCreationEnabled turned on.

    After calling CreateObject<T>() is the newly created poco proxy added automatically to the ObjectContext or one must explicitly add it via AddObject(). Or is it more performant to first manually instantiate the poco, init it with what is needed, and then add it via AddObject() ?

    Thursday, September 30, 2010 7:57 AM

Answers

  • Hi xenry,

    In one of my EF apps I'm calling CreateObject() and then the object is added to the context and afterwards i can call SaveChanges on the context applying the changes I've made on the object.

     

    Regards, Nicklas

    • Marked as answer by xenry Friday, October 1, 2010 8:10 AM
    Thursday, September 30, 2010 1:13 PM

All replies

  • Hi xenry,

    In one of my EF apps I'm calling CreateObject() and then the object is added to the context and afterwards i can call SaveChanges on the context applying the changes I've made on the object.

     

    Regards, Nicklas

    • Marked as answer by xenry Friday, October 1, 2010 8:10 AM
    Thursday, September 30, 2010 1:13 PM
  • thanks Nicklas
    Friday, October 1, 2010 8:10 AM