Sample .NET C # MVC project using the Entity Framework with a database First, Multi-Tie architecture and role-based security?

Is there an “official” or “best” way to implement a .Net C # MVC project using Entity Framework with Database, Multi-Tie architetire and role-based support?

I have done several MVC projects using the Entity Framework with the First database. Since the projects are relatively simple, so whenever I need to query, I create an object in the controller, I execute the LINQ query directly. Now, if I want to implement a multi-level architecture, does this mean that I need to reorganize all this data and separate all request codes at the service level? even for a very simple request?

As for role-based security, runtime, the user interface is different from the role. For example, for the administrator, all buttons should be displayed. but for the average user, maybe we want to show only one button. In this case, I usually use razor syntax and look at the role again in the controller. Is it correct?

I am wondering if there are some examples of projects in these cases. I could not find them after searching.

thank

+4
source share
1 answer

That sounds like a lot of unrelated questions.

  • Yes, for any complex solution, you really need to move all the database logic beyond the controller level.
  • . , - . , /, / , . , .
  • , . , , , if Razor. , - , , , .
+2

All Articles