ObjectDataSource - Program to interface, not to implementation

L

Ladislav Mrnka

Hello,

I am facing really annoying defect of ObjectDataSource. It allows me to
create data access object (ObjectCreating event) but it doesn't allow me to
create a data object! This feature is hardcoded in ObjectDataSourceView and
behavior of data object creation cannot be chaged. So I am bounded to
particular implementation and not to an abstraction! My data access objects
use update and insert methods with parameters typed to Interface
(abstraction) and not to particular implementation. This means reflection
implemented in ObjectDataSourceView fails to find these methods and it throws
an exception.

This is definitely bug, because programming to interfaces is one of the main
Object oriented design decision for reusable and maintainable code.

I wanted to inherit ObjectDataSourceView and add event for DataObject
creation. Unfortunatelly, like many other classes in .NET Framework
ObjectDataSourceView consists mainly of private or internal methods which
cannot be used to create my own version with similar functionality and little
effort. To add less than 20 lines of code I need to rewrite whole
ObjectDataSourceView and ObjectDataSource... It means more than 2k lines of
code in private methods. Really well designed components. My new object data
source will have limited usage in medium trust environment becasue of
reflection.

Also I can create adapter for each of my data access class (business class)
but that is somewhat absurd.

Is there any way to use Interfaces?

Thanks in advance,
Ladislav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,828
Latest member
LauraCastr

Latest Threads

Top