Thursday, February 09, 2012 Register    Login
Instructions

In order to add new threads or reply to existing posts, you have to be logged-in. If you are not registered yet, you need to register first, and then login with your personal credentials.

   

CslaFactory Forums
HomeHomeSupportSupportCslaFactory CTPCslaFactory CTPChange type of genereted IdChange type of genereted Id
Previous
 
Next
New Post
5/3/2008 9:42 PM
 

Can I change generated BO Id from Guid to Int type?  My DB table primary key is identity of int.

 
New Post
5/4/2008 1:02 PM
 

There are two automatically generated properties in every BusinessObject: nameID and LastModified. The Id is  of System.Guid and there is no easy way to change its type.

Personally, I would always prefer Guid to int as a primary key, but if there is a majority out there using ints, we surely will reconsider our design decision.

 
New Post
5/5/2008 11:36 AM
 
Marcel,
 
Thanks for answer. I think there are other developers who used int as a primary key, couse CodeSmith csla-templates doesn't apply restriction on that. It would be nice if you add this feature.
 
New Post
5/6/2008 11:15 AM
 

There are quite some disadvantages using ints as primary keys. The main reason for us to use guids are references. Using ints you only have two choices to determine new ids: let the database create an id (identity) or use a service to get a unique one. The prior is critical when creating a new BusinessObject that references other BusinessObjects by id, because you simply cannot refer to a BO that has no id. The second option forces you to provide a services that needs to handle concurrent access properly.

What do you suggest to manage this? How would you have the CslaFactory to be like to match your needs?

 
New Post
5/12/2008 3:27 AM
 
 
Previous
 
Next
HomeHomeSupportSupportCslaFactory CTPCslaFactory CTPChange type of genereted IdChange type of genereted Id


   

UsersOnline
Membership Membership:
Latest New User Latest: jerrytrucks
Past 24 Hours Past 24 Hours: 0
Prev. 24 Hours Prev. 24 Hours: 1
User Count Overall: 1588

People Online People Online:
Visitors Visitors: 3
Members Members: 0
Total Total: 3

Online Now Online Now: