Why are FK fields made into properties

Posts   
 
    
pilotboba
User
Posts: 434
Joined: 05-Aug-2005
# Posted on: 06-Aug-2005 19:23:59   

I am evaling your product. I was working with NHibernate but needed to move to a "released" product that was more established.

However, I am wondering why fields in the Db are created as properties in the Entity class?

For example, I have an akas table which is related (m:1) to a person table. A property named Person is generate to hold an object reference to the related Person entity. But, why is the PersonId field also mapped to a property. It seems to me that this is not needed in the entity class and just clutters up the object?

BOb

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 06-Aug-2005 19:47:30   

Well, you can now do: myOrder.CustomerID = _myCustomerID; and save myOrder without having to have the customer entity loaded into memory. This can save performance. Also for databinding purposes, these properties are required.

Frans Bouma | Lead developer LLBLGen Pro