Solarion
Honorary Master
- Joined
- Nov 14, 2012
- Messages
- 28,050
- Reaction score
- 17,804
Hi ladies and gentlemen.
I have this up and coming long term project I will likely be tasked with modernizing and re-structuring. This entire solution is about 12 years old and still utilizes what I could guess is 3 layer philosophy. It comprises the following:
An onion architecture, single application (class) which is small. It simply has the dbcontext, entities and some infrastructure services such as SendGridEmailer and TwilioSMSSender. It is a database first approach. I had to scaffold the entire existing database up to get my context/entities.
After this is where the waters start getting murky for me. The Services.
I'm going to pick a very simple example of what currently is. 20 or so of these front end projects use, for example, a GetEmployeeById method by literally calling a static Employee.GetEmployeeById. But to satisfy the different requirements of the callers, as I said, scattered with conditional logic.
What I am aiming to do. Good or bad?
Have one project which is the one I have, purely a data access layer.
Have standard CRUD services in this data access layer for each entity type, returning only Dto's to keep entities out of the callers.
Have each project implement it's own service where it can determine what it wants to do with the data.
Each project simply injects the required service interface it needs and takes it from there.
Your thoughts on how to proceed and where I can improve are appreciated guys.
I have this up and coming long term project I will likely be tasked with modernizing and re-structuring. This entire solution is about 12 years old and still utilizes what I could guess is 3 layer philosophy. It comprises the following:
- A single data access project using SQLClient.
- Around 50+ WCF/WebAPI/MVC4 front end projects.
- A massive "data layer" which is packed with SQL code, sql queries. Methods which seem to have numerous conditional statements to satisfy the requirements of the 50 odd front ends.
An onion architecture, single application (class) which is small. It simply has the dbcontext, entities and some infrastructure services such as SendGridEmailer and TwilioSMSSender. It is a database first approach. I had to scaffold the entire existing database up to get my context/entities.
After this is where the waters start getting murky for me. The Services.
I'm going to pick a very simple example of what currently is. 20 or so of these front end projects use, for example, a GetEmployeeById method by literally calling a static Employee.GetEmployeeById. But to satisfy the different requirements of the callers, as I said, scattered with conditional logic.
What I am aiming to do. Good or bad?
Have one project which is the one I have, purely a data access layer.
Have standard CRUD services in this data access layer for each entity type, returning only Dto's to keep entities out of the callers.
Have each project implement it's own service where it can determine what it wants to do with the data.
Each project simply injects the required service interface it needs and takes it from there.
Your thoughts on how to proceed and where I can improve are appreciated guys.