c# - How to create data access layer in mvc application -


i have requirement create register-login application mvc , application needs multilayered.

i don't know multi layer architecture, have read few times. believe in standart mvc application:

presentation layer - views bussiness layer - controls

and should put data access layer? in application when user clicks register, model comes action. check if model valid, put database using entity framework , redirect user welcome page data access layer missing in architecture.

where should put data access , responsibilities should give it?

for example, should move entity framework code other class or move code putting user database model itself?

you can create separate project data access layer. connect database , use ef in project, , write classes perform business operations using ef. can decouple business logic actual database access logic, , place them in separate projects, think unnecessary ef orm, , has data access logic.

now, reference project in mvc project, in views presentation layer. models viewmodels or business models. in case, need manage conversion between presentation layer , business layer. not in controller. create separate converter class this, following 'fat model, skinny controller' philosophy of mvc.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -