K
kownacek
Hello.
I have some classes which resemble tables in a database. I'd like to
create CRUD-like methods for each class, for example Create(),
GetAll(), GetById(Guid id), DeleteById(Guid id), etc...
I can implement an interface to force Create() for example, but
GetAll() should return a list/array of object and it should be static.
I cannot make static methods in an interface in C#.
Why do I want interface at all? So I can make a universal unit test
for those CRUD methods.
I've already created a universal property comparization method (using
reflection) which could be used in this universal unit test...
So I thought (as I do know a bit 'bout Java) - i'll just create an
interface...
I know I can use reflection in the unit test aswell, but interface
seemed easyer and more natural.
I dont know if i'm following the correct path at all. Ty in advance.
I have some classes which resemble tables in a database. I'd like to
create CRUD-like methods for each class, for example Create(),
GetAll(), GetById(Guid id), DeleteById(Guid id), etc...
I can implement an interface to force Create() for example, but
GetAll() should return a list/array of object and it should be static.
I cannot make static methods in an interface in C#.
Why do I want interface at all? So I can make a universal unit test
for those CRUD methods.
I've already created a universal property comparization method (using
reflection) which could be used in this universal unit test...
So I thought (as I do know a bit 'bout Java) - i'll just create an
interface...
I know I can use reflection in the unit test aswell, but interface
seemed easyer and more natural.
I dont know if i'm following the correct path at all. Ty in advance.