Implenting ActiveRecord with inheritance?

Posted by King on Programmers See other posts from Programmers or by King
Published on 2012-08-02T17:53:47Z Indexed on 2012/09/02 9:50 UTC
Read the original article Hit count: 200

I recently converted an old application that was using XML files as the data store to use SQL instead. To avoid a lot of changes I basically created ActiveRecord style classes that inherited from the original business objects.

For example

SomeClassRecord :SomeClass
//ID Property
//Save method

I then used this new class in place of the other one, because of polymorphism I didn't need to change any methods that took SomeClass as a parameter.

Would this be considered 'Bad'? What would be a better alternative?

© Programmers or respective owner

Related posts about .NET

Related posts about design-patterns