How to create a multi-tasking portal application in ASP.NET MVC

I just watched Scott Hanselman's presentation at ASP.NET MVC in San Francisco. After thinking about this for a while, I was at a standstill regarding the best approach to creating an ASP.NET MVC site that has the structure [portal | modular | multi-view] (select your favorite definition).

To give you an idea of ​​what I need, my company creates many portal-style applications for clients, which include a matching module that can respond to its own lines and query routes, a tax bank information module similarly has its own look (s ), viewing a document that displays one or more documents ... you get an idea. The critical part is that each module is truly self-contained. If a user searches for a tax record by name, they can see 10 results ("JOHN DU" owns several properties). Each result has a “Map” link because the website infrastructure knows that there is an available map module. The Map link sends the correct request, for example, http: // myapp.com / taxparcel / map / 123443. The card module controller responds to an external request, zooming in to the card and highlighting a tax lot.

The key to this stream is that both the tax and display modules are on the same web page.

So how does this relate to the ASP.NET MVC mailbox? Partials? Subsections? Several types for one controller? If I just skip the obvious part of the documentation, then feel free to publicly publish it and include the link. Otherwise, I am widely open to suggestions.

+3
source share
2 answers

Well, your view model should provide extension points. I assume that the data for the presentation contains these parts of the module and is somehow selected by the controller:

public ActionResult Search(string text)
{
   var model = seachService.Search(text)
   // here either:
   // 1. model contains .Modules collection and is populated by the service, or
   // 2. controller does
   var viewmodel = new SearchViewModel(model, modulesService.GetModulesFor(model));
   // i.e. it adds modules-specific information to the view data
   return View(model);
}

, , SearchViewModel -, View:

public interface IModuleSpecificViewPart
{
  public IList<string> GetAdditionalLinksForUser();
  public void RenderAdditionalInfo(Response response);
}

<%= Model.Results[i] %>
<% foreach (var module in Model.ModuleSpecific) { %> 
<a href="<%=module.AdditionalLink%>">More</a> 
<% module.RenderAdditionalInfo(Response); %>
<% } %>

.. , .GetModulesFor() SearchViewModel, - , SearchViewModel IoC.GetInstanceByType( "ModuleViewModel" + Module.GetType(). Name) - .

. , - , .

, , , ( ). , , - ! - . "", .

+2

, queen3 , , .

- , , blogpost. MEF, dll , .

. RenderPartial , , . RenderAction, , . RenderAction , MVC. , , , . MVC-, .

RenderAction .

0

Source: https://habr.com/ru/post/1720612/


All Articles