I am working on my 2nd project with Entity Framework and I would like to read some opinions about if the code below its good coding practice of not.
My proposed architecture is this:
So, the website calls the business logic, business rules are evaluated there. THen it calls the DALFacade, its just that its invisible for the upper layers whether if we are accessing db2 or sql server.
The EF DAL, its the one in charge of talking with database, CODE FIRST Approach. The entities class library is the project with the poco classes. Utilities its self explanatory, I might put there code like reading properties from active directory.
SO here is my code, I simplified it as much as I could
OnePage:
protected void BtnSubmitRequestClick(object sender, EventArgs e)
{
var ecoBonusWorkflow = new EcoBonusWorkflow
{
IsOnHold = true
};
BusinessLogic.EcoBonusRequestSave(ecoBonusWorkflow);
}
BUsiness Logic:
public static class BusinessLogic
{
public static void EcoBonusRequestSave(EcoBonusWorkflow ecoBonusWorkflow)
{
if (true)
{
DalFacade.EcoBonusRequestSave(ecoBonusWorkflow);
}
}
}
DALFacade:
public static class DalFacade
{
private static readonly UnitOfWork UnitOfWork = new UnitOfWork();
public static void EcoBonusRequestSave(EcoBonusWorkflow ecoBonusWorkFlow)
{
UnitOfWork.EcoBonusWorkflowRepository.InsertEcoBonusWorkflow(ecoBonusWorkFlow);
}
}
Then in the EF Dal class library I use the traditionary EF 4.1 Code First Approach. I used also Repository Pattern and Unit of Work.
Any observation is welcomed