Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Another 'Newbie' question - Identity inserts
 

Pages: 1
LLBLGen Pro Runtime Framework
Another 'Newbie' question - Identity inserts
Page:1/1 

  Print all messages in this thread  
Poster Message
CliffH
User



Location:

Joined on:
03-May-2006 14:27:07
Posted:
52 posts
# Posted on: 17-May-2006 17:42:02.  
Can anyone give me a quick example of how to retrieve a saved record in a table with an identity column, i.e., you default all identity columns to 0, you save a header record, but to save the related data you need to know the number of the just saved header record.

Any suggestion grateful.
  Top
bclubb
User



Location:
Norman, Oklahoma
Joined on:
12-Feb-2004 22:18:04
Posted:
934 posts
# Posted on: 18-May-2006 02:38:47.  
CompanyId is an identity column and a FK in Employee. This is using SelfServicing

Code:
CustomerEntity customer = new CustomerEntity();
EmployeeEntity employee = new EmployeeEntity();

customer.Name = "Test Company";
employee.Customer = customer;
employee.Name = "Test Employee";

// This is a recursive save of the company that will also save the employee with the
// proper CustomerId FK.
customer.Save(true);

// At this point now customer.CustomerId will have a value != 0 and
// employee.CustomerId will have the same value.


  Top
CliffH
User



Location:

Joined on:
03-May-2006 14:27:07
Posted:
52 posts
# Posted on: 18-May-2006 08:01:22.  
Thanks for this. Beginning to see the power of this product. Will also try UnitOfWork as well.
  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.