It is a bit of both :)

I like using interfaces because they give me the ability to provide a
different implementation without the need to change the usage. So when
having that in mind I like to start out with interfaces and also build
my tests based on them. Then when needed I would create (using R# so
no real work anyway) my implementations, but since mine will do
nothing more then hold the data they could just as well be generated
(not the class files as in LLBLGen, more like mocking). I like my
business logic to be something like Billing.SendInvoice(IUser,
IInvoice); where Billing is not an entity, but because I don't always
succeed in this it is important that I can change the implementation
of the dumb entity into a smart entity.

Another thing would be to use an IoC as the entity factory and that
way you could easily change the implementation of each entity whenever
that is needed, but if I understand it correctly that already is in
place? Then the only real thing left (with respect to Fluent
NHibernate) is having the AutoMapper generate mapping in Interfaces.
But as you mentioned that is also already working.

Hmm doesn't leave much then... except I would like to get the entity
generator :) maybe something like if the IoC doesn't have an matching
object the entity generator will create a mock (I don't know how this
should be called). so you only create an implementation to entities
that are not dumb.

-Mark





On Dec 3, 1:53 pm, "Paul Batum" <[EMAIL PROTECTED]> wrote:
> Ahh, sorry for misunderstanding, I did not read your post carefully enough.
> I must admit the approach you are looking to explore never occurred to me,
> because I treat my entities as the "core" of my application - they are where
> all the business logic goes!
>
> So the benefit you are looking to gain by using interfaces is not
> polymorphism or pluggability, but rather than interfaces are a strongly
> typed and succinct way of describing entities? What advantage would this
> approach have over using a framework that will generate you classes based on
> your database structure? Both approaches will give you dumb entities that
> are 100% generated. From my point of view, the advantage of using interfaces
> is that it makes it easy for you to inject different implementations - but
> if all your entities are generated then there are no different
> implementations to inject!
>
> Paul Batum
>
> On Wed, Dec 3, 2008 at 8:22 PM, <[EMAIL PROTECTED]> wrote:
>
> > I forgot thanks for the link, very interesting.
>
> > On Dec 3, 1:44 am, [EMAIL PROTECTED] wrote:
> > > Hi,
>
> > > I have been using your Fluent NHibernate libraries now only for a very
> > > short time and I think it is great and I have an idea that I would
> > > like to explore.
>
> > > I would like to be able to define my object structure using interfaces
> > > only, then have the mappings be resolved accordingly to the interfaces
> > > relations. Then finally I want some factory that will create new
> > > objects depending on the requested interface, exactly like a mocking
> > > framework would do it, whenever NHibernate needs to provide me with a
> > > new entity. I would also need a way to do this manually like
> > > Repository.Give<T>() (or what ever) so that I can request a new
> > > instance that implements my interface.
>
> > > The reason for this is that I want my entities to be dumb, and I want
> > > to be able to use interfaces and also maintain the references using
> > > only interfaces. Now with these two wishes there is really no use for
> > > creating actual implementations of these objects. I can see there is a
> > > performance hit by using this scenario so for an production
> > > environment I would probably want to have the actual implementations
> > > created, but I would still like to only use interfaces in all my other
> > > code.
>
> > > Especially during development iterations I think this can be useful
> > > and depending on performance it might be useful for more, but I don't
> > > know that.
>
> > > So my question is: What do you guys think of this? I am very happy
> > > exploring this by my self and contributing back if indeed it is
> > > useful, but I like some small pointers as I am still new to NHibernate
> > > and I don't seem too figure out what I have to do to have NHibernate
> > > mock entities (maybe also because it is getting very late). I Found
> > > IProxyFactoryFactory but I am no sure if that is the place to be.
>
> > > Any feedback is appreciated.
>
> > > -Mark
> > > [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to