Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move models to separate project .NET MVC

Tags:

asp.net-mvc

I created .NET MVC application and I want to move my models (and then Controllers) to a different project in my solution.

I'm a noob in MVC so I need simple explanation please.

Thank you very much

like image 266
Burjua Avatar asked Dec 27 '22 17:12

Burjua


1 Answers

  1. Add a project to your solution called "YourProject.Models".
  2. Add references to System.Data, System.Data.Linq, System.Data.DataSetExtensions (if you're using Linq to Sql)
  3. Add a reference from your original MVC project to the new "models"project.
  4. Move your model classes from your MVC project to the new project.
  5. Compile and run.
like image 112
Andrew Lewis Avatar answered Jan 20 '23 20:01

Andrew Lewis