Application Design Help!!!

G

Guest

Hi All
I am desperately looking for some help in design issues, wondering if you
could help me!!!

I am desigining an n-tier .NET web application with
UI--Facade--BusinessLogic--DataAccess---Database layers.using ASP.NEt2, C#2,
SQLServer2000....

I have used Codesmith code generation tool with NetTiers template to
geenerate DAL and Business Logic Layer components along with Stored
Procedures. It has basically generated typical DAL components for
CRUD(Create/Retrieve/Update/Delete) operations and business entity classes at
BLL layer.

Now i am stuck with designing a facade layer to make use of the "Business
entities and DAL classes" generated. My idea is to implement a common access
interface for UI to interact with BLL/DAL classes(exactly in lines with a
standard facade factory pattern).I have issues troubling me for over 2 months
now, i have searched for a working/real world example of facade
implementation on NET but no luck...
Could you please help me....

My project requirement is something like this...

I have got a facade factory that creates facade classes for individual
entities (for ex:Organisation, employee, customer etc...)and return a common
interface(say IFacade). At this stage i should mention that my application
has just to achieve simple CRUD implementation with a little master detail
business logic. Each Facade class (implements common interface that is the
return type of facadefactory.createfacade(facadetype) method) should call
business entities/ DALComponents at the generated code layer and return data
transfer objects(OR CRUD result basically!!) that could be either bound to UI
controls or used to populate UI. What all i wanted to know is how best i can
design facade layer so that it returns a common interface that can be used to
implement CRUD methods.

For ex:
I want to design my facade layer in such a way that the following calls
return a common interface (IFacade) to call CRUD methods of generated code...
IFacade = FacadeFactory.Createfacade(FacadeType.OrganisationFacade)
IFacade = FacadeFactory.CreateFacade(FacadeType.CustomerFacade)
IFacade = FacadeFactory.CrateFacade(FacadeType.EmployeeFacade)
and something like
OrganisationDataSource = IFacade.GetAllOrganisations() -- in case of
Organisation select
OR IFacade.Create(Organisation) / IFacade.Update(Organisation)
/IFacade.Delete(Organisation)

CustmoerDataSource = IFacade.GetAllCustomers() -- in case of Custmoers
OR IFacade.Create(Customer) / IFacade.Update(Customer)
/IFacade.Delete(Customer)
so on...
I really appreciate your response as i am still not very clear in this
regard...

Thank you very much in advance!!!!
Sriram
 
G

Greg Young

I think part of the problem that you are running into is that you sounds
like you are sufferring from the anemic domain anti-pattern
http://www.martinfowler.com/bliki/AnemicDomainModel.html generally you can't
automagically generate your business layer, if you try you end up with an
anemic domain.

Facde layers aka Service layers in general are also tough as we have a
tendency of moving business logic into the service layer, leading to an
anemic domain.

A good litmus test for you, is if deleted your service layer ... how much
logic would be gone?

I will also recommend a few good books ... Eric Evans, Domain Driven Design,
Martin Fowler P of EAA, and Jimmy Nilsson's new book Applying Domain Driven
Design and Patterns which looks specifically at a C# environment
http://www.amazon.com/exec/obidos/t...bs_b_2_1/102-3319163-1611303?v=glance&s=books

Cheers,

Greg
 

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

Top