@@Identity ?

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 03-Jan-2007 05:49:47   

I have a PersonEntity which has a PersonID as a PK. That field is auto updated in the DB when a new person is added.

When I do something like this below, I need to know the PersonID which was created. (@@Identity basically)

PersonEntity p = new PersonEntity();
p.Name = "Ian";
p.Save();

What is p.PersonID after the save?

Cheers, Ian

ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 03-Jan-2007 06:23:09   

Oops. I see it is auto filled into the Person object after the Save()

Nice design guys!

Ian