c# - MVC 3 solution with two views/controller/model. (Possible MVC, MVP hybrid?) -


i starting mvc 3 , planning in separating model , controllers own separate projects. i'll follow suggestions made post this:

asp.net mvc put controllers separate project

the purpose of separating them separate projects there chances may have add web service project solution , i’d reuse same functionality exposed controller project. solution formed of 2 view projects, webservices , website, controller project , model project.

i’d know if possible , if it’s common scenario mvc.

update 1:

with suggestions agree , think it’s best keep view , controllers together.

would possible have hybrid of mvc , mvp? have feeling overdoing things here please let me know think.

so have:
1 – web project controllers.
2 – webservices project
3 – presenters/interfaces.
4 – model.

the controllers become views in mvp model. each web service become view in mvp model.

for instance have following, interface, presenter , controller.

public interface icustomers {     string[] customers{set;} }  public class customerpresenter {     icustomers view = null;     public customerpresenter(icustomers view) {         this.view = view;     }      public void getcustomers() {         view.customers = new string[]{"customer1","customer2"};     } }  public class customercontroller:icustomers {      customerpresenter presenter = null;     public customercontroller() {         presenter = new customerpresenter(this);     }      private string[] customers = null;     public string[] customers {         set { throw new notimplementedexception(); }     }      public void getcustomers() {         presenter.getcustomers();         //return view.     } } 

the webservice view in mvp model.

    public class customerwebservice:icustomers {      customerpresenter presenter = null;     public customercontroller() {         presenter = new customerpresenter(this);     }     [webmethod]     public void getcustomers() {       presenter.getcustomers();      //return response.  }  

my projects built reason stated, want implement web service. not recommend separating controllers because actual part of web project. want around 3-4 different projects.

  1. repository/data layer (may contain domain level models)
  2. domain layer (optional)
  3. service layer. (now can point web service easily, re-usable logic should here, not in controller)
  4. web layer. (contains view models, views , controllers)

i placed them in levels. basically, repository, domain , service layer de-coupled, meaning can use these libraries without server or asp.net. wpf application can call service layer because web layer presentation purposes.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -