New Posts New Posts RSS Feed: Clarity needed around creating and inserting related entities in the same "transaction".
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Clarity needed around creating and inserting related entities in the same "transaction".

 Post Reply Post Reply
Author
pompomJuice View Drop Down
Newbie
Newbie
Avatar

Joined: 29-Jul-2010
Location: ZA
Posts: 28
Post Options Post Options   Quote pompomJuice Quote  Post ReplyReply Direct Link To This Post Topic: Clarity needed around creating and inserting related entities in the same "transaction".
    Posted: 27-Oct-2010 at 3:36am
amagad this forum does not work in chrome at all.
Lets try again in Microsoft Exploder ( which is slow as molasses )
 
I ran some tests before surrounding the following (common) scenario:
 
1: SomeEntity newEntity = EntityManager.DefaultManager.CreateEntity<SomeEntity>();
2: newEntity.someRelatedEntity = EntityManager.DefaultManager.CreateEntity<SomeOtherEntity>();
3: EntityManager.SaveChanges();
 
I get the following exception at line 2: Null or pending entities cannot be modified
 
I might be confused, but I spesifically checked before if devforce can handle such behaviour and it could. Now (6.06) it cant.
 
What am I doing wrong? Both entities recieve their PKs from the database ( they are IDENTITIES).


Edited by pompomJuice - 27-Oct-2010 at 3:37am
Back to Top
pompomJuice View Drop Down
Newbie
Newbie
Avatar

Joined: 29-Jul-2010
Location: ZA
Posts: 28
Post Options Post Options   Quote pompomJuice Quote  Post ReplyReply Direct Link To This Post Posted: 27-Oct-2010 at 5:33am

Nevermind.

It does work nothing changed, i had a bug in my code.
 
Thanks.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down