ObjectFactory vs DataPortal - inconsistent naming

ObjectFactory vs DataPortal - inconsistent naming

Old forum URL: forums.lhotka.net/forums/t/7578.aspx


JonnyBee posted on Sunday, September 06, 2009

Hi Rocky,

I got into a little confused on method naming in ObjectFactory last week.

On a CommandObject - calling DataPortal.Execute:
  1. Without ObjectFactoryAttibute calls the DataPortal_Execute method
  2. With ObjectFactoryAttribute calls the factory.Update method
I was expecting to use a factory.Execute method and not the factory.Update method to keep the metod naming consistant.

/jonnybee

rfcdejong replied on Sunday, September 06, 2009

We haven't used any Command yet, but i agree i think it should be factory.Execute()

RockfordLhotka replied on Monday, September 07, 2009

I'll take this under consideration.

I specifically chose to leave it as create/fetch/update/delete for all objects, since 'execute' is just a renamed update. Adding the 'execute' call means doing another type check on all data portal operations to see if the object inherits from CommandBase and I was doing a (certainly minor) performance optimization to avoid the cast.

Ultimately it is important to remember that my goal with object factory is to support a future version of EF where you (hopefully) wouldn't write each factory object by hand, but rather it would delegate into some code that is at least partially generated by EF.

But if it is really too confusing it might be worth making the change, even if my ultimate EF implementation needs to somehow bypass it or something.

Copyright (c) Marimer LLC