FK not set

Posts   
 
    
ChBaeumer
User
Posts: 175
Joined: 23-Oct-2003
# Posted on: 10-May-2005 13:24:23   

Hi,

following happens with the latest version:


table Element (
Id UNIQUEIDENTIFIER PRIMARY KEY
)

table ElementName (
Id UNIQUEIDENTIFIER PRIMARY KEY,
ElementId UNIQUEIDENTIFIER NOT NULL -- this is an n:1 relation to table element
)

When I create a new Element entity I create within the cons a new ElementName entity


// more or less the thing I'm doing
Element(string name) : base() {
  this.Id = Guid.NewGuid();

  ElementName _elementName = new ElementName(name);
  this.ElementName.Add(_elementName)
}


I would expect that the last line syncs the FK of the ElementName entity but it doesn't. When I commit this entities I get an exception that ElementName.ElementId cannot be null. Both entities are newly created.

Christoph

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 10-May-2005 13:29:25   

This is in your own class? If so, what's this.ElementName, an overriden property?

Frans Bouma | Lead developer LLBLGen Pro
ChBaeumer
User
Posts: 175
Joined: 23-Oct-2003
# Posted on: 10-May-2005 15:21:03   

Shame on me flushed

I accidentically registered the Element entity for delete before committing the unitofwork

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 10-May-2005 15:56:20   

ChBaeumer wrote:

Shame on me flushed

I accidentically registered the Element entity for delete before committing the unitofwork

Tssk wink Glad it's solved! simple_smile

Frans Bouma | Lead developer LLBLGen Pro