New Posts New Posts RSS Feed: Creating new one-to-one Entity Pairs
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Creating new one-to-one Entity Pairs

 Post Reply Post Reply
Author
chuckc View Drop Down
Groupie
Groupie


Joined: 27-Feb-2010
Posts: 54
Post Options Post Options   Quote chuckc Quote  Post ReplyReply Direct Link To This Post Topic: Creating new one-to-one Entity Pairs
    Posted: 05-May-2010 at 8:39am
What's the proper way to create new Entities when they are related one-to-one?
 
The snippet of code below hopefully gives an idea of what I'm trying to do. 
 
public static Company Create(iCatalystEntityManager manager)
{
   Company company = manager.CreateEntity<Company>();
   company.CompanyId = Guid.NewGuid();
   company.Group =
Group.Create(manager);
   //Need to somehow get company.Group.GroupId = company.CompanyId ??
   company.EntityAspect.AddToManager(); // throws exception when Group and Company are one-to-one
   return company;
}
 
I changed my schema to get rid of the one-to-one so I could move on, but I'll need to restore that relationship soon.
 
Thanks!
 


Edited by chuckc - 05-May-2010 at 8:41am
Back to Top
dkearney1 View Drop Down
Newbie
Newbie
Avatar

Joined: 20-Jul-2007
Location: United States
Posts: 27
Post Options Post Options   Quote dkearney1 Quote  Post ReplyReply Direct Link To This Post Posted: 05-May-2010 at 12:53pm
company.Group = Group.Create(manager, company.CompanyId);
Dan
“In anything at all, perfection is finally attained not when there is no
longer anything to add, but when there is no longer anything to take away.”
Saint-Exupéry
Wind, Sand, and Stars
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down