Difference between revisions of "Deprecated Id Properties"
(New page: 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 ...) |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | 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. | + | 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. |
+ | |||
+ | For AbleCommerce Gold in 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. | 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. | 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. | ||
+ | |||
+ | NOTE: Though we have duplicate/repetitive properties for each entity class (e.g. ProductId and Id for Product class), using Id is preferred. All of our classes have an Id property (even the ones using composite keys). | ||
+ | |||
+ | [[Category:AbleCommerce Gold]] |
Latest revision as of 11:21, 15 August 2013
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.
For AbleCommerce Gold in 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.
NOTE: Though we have duplicate/repetitive properties for each entity class (e.g. ProductId and Id for Product class), using Id is preferred. All of our classes have an Id property (even the ones using composite keys).