Architectural designs and technology

razza_b
razza_b used Ask the Experts™
on
Hi

I'm looking to get some feedback on the best approach to designing a new system.

Basically our company like to keep all the business logic contained within the database(stored procedures), its always been like this and needs to stay the same. So we have been asked to come up with new layered applications using the latest .NET Core with VS2017 (MVC & WPF MVVM). The reason these 2 have been mentioned is that they are the best way forward in terms of web and windows based applications...do correct me if I'm wrong.

My question is...What would be the best way to design layers around keeping business logic in DB?

Having not used any of these technologies I'm looking to find good examples of how I can approach setting up layered architecture, based on our business needs.

Could we use EF7 using stored procedures or EF using LINQ? or just use plain old ADO.net without EF?

Could we still use layers like so with or without EF (Presentation Layer, Service Layer(API), Business Layer, Data Layer)? Either way any examples would be great.

And could both technologies both benefit using these layers -> Service Layer(API), Business Layer, Data Layer for reusability?

Any feedback most welcome and appreciated.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Software Engineer
Top Expert 2009
Commented:
My preference will be: (Presentation Layer, Service Layer(API), Business Layer, Data Layer and having a Utils class that contain the general helper classes and methods you may have.
Having an API make things simpler in terms of encapsulating and sharing your logic among multiple products.
Also, you should use EF7, it is used to map your DB tables to objects in your code and yes you can run store procedures and use LINQ
in the results.
For web I will consider ASP.NET Core , also adding a JavaScript framework like angular or react (depending on how the UI user specs are)  and CSS framework like Bootstrap.

Cheers,
PawełI Design & Develop Software
Commented:
It's a matter of opinion, personally i think you guys made a great decision by keeping your logic in stored procedures, now it really doesn't matter what design pattern you use, you can just leverage the Stored procedures in your db, and just use your applications as data consumers, almost like thin clients, your applications are just getting and posting information.

I wouldn't access the data directly from your applications, i'd build a webservice that exposes end points your applications can interact with and have the web-service interact with the database. at the webservice layer you could most definitely leverage entity framework, but that's just a matter of preference.

anyway i'm sure someone will disagree with me, but it sounds like you've got it figured out and are on the right track

Author

Commented:
Thanks for your comments guys, as you say its a matter of preference and also getting to know and understand the architecures.

Pawel,

Using the web service/web service layer interact with the Data layer does that mean using no BL classes?
just trying to get my head around the whole layered thing with MVC and ASP.Net. how would that work?

Also do you guys have any examples I can follow to see how all this hangs together?

Thanks!!
PawełI Design & Develop Software
Commented:
what we're discussing really isn't new, here's a link to get you started.

https://msdn.microsoft.com/en-us/library/aa581779.aspx?f=255&MSPPError=-2147217396

I think it's a webforms example, but ignore that part, focus on the idea, not the implementation.

the idea is that the data access layer (DAL) gives you access to the DB, so that you can have multiple consumers of the same data go through the same entry-point, then if you need to change the Data layer you only have to worry about the web-service (DAL). and if you want to make a webapplication, a native ios app, and a UWP app the they can all use the same webservice for CRUD operations to the database.

as for your Business layer, you can put it wherever you please, personally I'd enforce my rules at the DAL, to ensure whoever creates the different consumers applications can't mess up my database. it's fair to say that the various consumers will also need to leverage Business rules so putting them into a portable class library probably makes sense.
Miguel OzSenior Software Engineer
Top Expert 2009
Commented:
@Pawel: I do agree with "enforce my rules at the DAL", thus the reason why my comment added BL to the service.
@razza_b: You could  have 2 business layers:
- UI business layer. (e.g. custom html helper classes)
- Service business layer. (e.g. what ever rules)
It all depends of project needs.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial