Deprecated Id Properties

From AbleCommerce Wiki
Revision as of 15:37, 29 November 2012 by Naveed (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

For AbleCommerce 7.0.[0-7] all entity classes had Id properties with class names which were also matching the database column name, for example "ProductId" property for Product class. But for AbleCommerce Gold for all entity classes the Id property is renamed to "Id", though we still have alias properties with old names for backward compatibility. The underlying reason is a combination of NHibernate and generics. We have a single base "Entity" class. This class defines a property named Id and this is shared in common with all of our objects that are mapped to the database. This is the field that actually does the work, while the ProductId field is just an alias to the Id property. And the Id property is here to stay. It seemed odd to have two names for the same property so the alias was deprecated.

To a lesser extent a reason was that common practice with NHibernate is to have a mapped field named Id. So if we had been starting from scratch we likely would have used Id as the table column name rather than ProductId to better match those patterns.

Right now there is no plan to actually remove the properties. The obsolete warning was added to encourage people to prefer the Id property and also to ensure we updated all of our internal codes.