dimanche 19 février 2017

How to implement business logic in MVC 5 with EF6

I've read the MVC5 with EF6 DB First tutorial. With this tutorial, it will generate code (controller and view).

I have created 3 projects in VS:

+ AdminWebSite
+ PublicWebSite
+ EntityFramework

And I've question, where should I implement the business logic, and share it will multiple website (Admin & Public)?

The business logic may include:

  • Logic with database (i.e. Transaction with multi-table)
  • Logic with SharePoint info
  • Logic with Email Server

EDIT

Typo, should be 3 projects instead of 3 solution, but it should be similar case, which AdminWebSite and PublicWebSite have add EntityFramework as reference.

EDIT 2

Before the MVC3, I will create a class project which includes all business logic, and also the Repository class. So that every WebSite or WebServices can use the same business logic (but I'm not sure is it the best practice).

But when move to MVC5 with EF6, the repository and unit of work seems gone. And don't want to implement repository for every table, which some tables just for direct CRUD without business logic.

I hope this can clarify the is Too broad.

Aucun commentaire:

Enregistrer un commentaire