c# - How to implement n-layer architecture in MVC? -


I know that this question has been asked before. I'm just asking that I can get better explanation in my webform applications, in this way I have implemented my projects. Two solution projects were the first project included data access and business logic. The first project is referred to in the second project aspx.cs called the business logic class and the business logic class says the data access class.

I am trying to follow the same approach in my MVC programs. How do I apply it? Controller call model which in turn is called business logic? Will this approach add overhead accuracy?

In the context of the direction the comment is taking this thread (it does not fit neatly in a comment ):

The model folder created with a new MVC project is for the model - they have classes to support ideas. These are not your business model or data model. For example, in a view model that supports a view, you may have a potential property that renders in the dropdown:

  public em Customer Type {person = 0, Company} public class customer view model {public customer type type {get; Set; } Public String [] Customer Type Search List {get; Set; }} Public Class Customer Controller: Controller {Edit Public Action () {var model = New customer view model (); Model.CustomerTypesSelectList = Enum.GetNames (Typf (Customer Typing Selection List)); See Return (Model); }}   

And with this you have some javascript in your view to populate a fancy drop down list with items in the Customer Type Selection List .

UI-specific string [] The property is a common build of a view modal that is removed after converting it into a business model or data model. Mapping), but may rely on another class to implement mapping, which connects the realm and business model together.

In an N-layer architecture, in a nutshell:

  1. MVC controller is not your business logic Your business logic stays inside various services and components called by the controller is.
  2. There are ViewModels-squares in the module folder that only support the operation of the UI.
  3. The controller asks a mapper to translate between the view model and the business model.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -