Saturday, February 8, 2014

asp.net mvc how to separate module wise controller, model, view

First take a look on this.

http://stackoverflow.com/questions/5243158/how-to-configure-areas-in-asp-net-mvc3



In ASP.NET MVC application MVC gives use 3 part Controller, Model & View. But if we want to separate the  Controller, Model & View as our application Module based we can also implement this using AreaRegistration. Consider i want to use PIS module with seperated Controller, Model & View. i have to add a user define class, i just named it PISAreaRegistration.


  public class PISAreaRegistration : AreaRegistration  
   {  
     public override string AreaName  
     {  
       get  
       {  
         return "PIS";  
       }  
     }  
     public override void RegisterArea(AreaRegistrationContext context)  
     {  
       context.MapRoute(  
         "PIS_default",  
         "PIS/{controller}/{action}/{id}",  
         new { action = "Index", id = UrlParameter.Optional }  
       );  
     }  
   }  

if you want to add more module like PIS then you have do the all process as PIS done.

Ensure that this project has Microsoft.Bcl.Build installed and packages.config is located next to the project file

In my Xamarin form application their was dependency Restclient on Microsoft.Bcl.Build Microsoft.Bcl. i just remove all using nuget and ...