ObjectDataSource - Program to interface, not to implementation

Discussion in 'ASP .Net Web Controls' started by Ladislav Mrnka, Mar 30, 2009.

  1. 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
     
    Ladislav Mrnka, Mar 30, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Will
    Replies:
    3
    Views:
    5,850
  2. rote
    Replies:
    0
    Views:
    1,163
  3. Michael Tsang
    Replies:
    32
    Views:
    1,123
    Richard Bos
    Mar 1, 2010
  4. Michael Tsang
    Replies:
    54
    Views:
    1,204
    Phil Carmody
    Mar 30, 2010
  5. David Thielen

    ObjectDataSource method as another ObjectDataSource

    David Thielen, Mar 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    246
    Steven Cheng[MSFT]
    Mar 23, 2006
Loading...

Share This Page