Fluent nHibernate with Dependecy Injection & Inversion of Control

51 views
Skip to first unread message

Fabricio Pellegrini

unread,
Dec 17, 2012, 8:56:13 AM12/17/12
to fluent-n...@googlegroups.com, Filipe Araujo, Vitor Luiz {VIAJANDO}
Hello guys,

I'm working on a project that we are making a big redesign of its architecture.
In the past, all the systems here were sold in one big package. Even if the client didn't need the system "B", he would have it installed but blocked using a flag in a database table.
They were doing so, because they didn't have time/people to design a less coupled architecture.

Our current design is a basic three layered architecture:
  • DTO - POCO classes.
  • DAL - nHibernate & fluent mapping.
  • BLL - Business layer. 

We tried to decouple the big system into small systems following the same architecture.

System A:
  • A.DTO
  • A.DAL
  • A.BLL 
System B:
  • B.DTO
  • B.DAL
  • B.BLL
But we run into some cyclic references, since some classes of A.DTO uses classes of B.DTO, vice versa.
Our first shoot was to reduce the coupling through Dependency Injection at the DTO and BLL layers. 
Now we are struggling to map our DTO classes with fluent since we need to deal with multiple inheritance. 
After some "googling", we found many comments and discussions that there is no reason to use DI in the DTO and it should be avoid, which makes me think that we were going into the wrong way.

In my case, what could be done to decouple my system into small systems, is there a better common architecture for it?
Should I separate my DTO classes into small projects or keep them in one big DTO?

Thanks






Surya Pratap

unread,
Dec 17, 2012, 9:55:41 AM12/17/12
to fluent-n...@googlegroups.com

as a general suggestion unless the systems A & B consume data from different tables in the database you will not require a separate DAL & DTO for each system. It may be easier to just decouple the BLL first into A.BLL & B.BLL first and then decide if you can/need to decouple the DTOs.

I am not sure if anyone can suggest a clear answer to this without a little more information on the domain.



--
You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
To view this discussion on the web visit https://groups.google.com/d/msg/fluent-nhibernate/-/7s_QNEURcZwJ.
To post to this group, send email to fluent-n...@googlegroups.com.
To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.

Fabricio Pellegrini

unread,
Dec 17, 2012, 1:11:27 PM12/17/12
to fluent-n...@googlegroups.com
It seems the right thing to do, at least for now. 

Thank you very much for your reply.


--
------------------------------------------------------
Fabrcio G. Pellegrini

+55-7199785357

Reply all
Reply to author
Forward
0 new messages