We are developing web application based on ASP.net with MVC3. Our requirement is to compose/present a page dynamically based on a configuration saved by Administrator. We need to load multiple components (in our case partial views) dynamically for a module/screen.
as per configuration (Deployment for a customer). The configuration file will look like.
Client Id
Configured Component
Client1
SelectionCriteria
SelectionCriteriaVer1Component
PlanningSection
PlanningSectionVer2Component
AnalysisSection
AnalysisSectionVer3Component
All these three will be construct a screen/page.
Client2
SelectionCriteria
SelectionCriteriaVer2Component
PlanningSection
PlanningSectionVer1Component
AnalysisSection
AnalysisSectionVer1Component
All these three will be construct a screen/page.
We are using partial views for each component and render logic is written in controller. We are using StructuredMap to achieve this for dependency injection. Please suggest better the approach if we are in wrong direction.
This is good as per your requirement and I don't see any need to change anything. Except couple of question...
- Are you creating a new view for each client, even though the views differ in only couple of fields
- Do you create a view1 and view2, if both view1 and view2 has all the fields same except one. If yes wont' this create a huge collection of almost similar views even though individual elements hardly differ.
- Are there any sort of validation or business rules changes across almost similar views?
Hope these questions are valid in this context..
I blog at http://rajeshpillai.net and have a community startup http://ownabook.org/
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
Marked as answer by akfkmupiwu on Apr 12, 2012 12:50 PM
Yes we are planning to create new views even for small changes like adding/removing of single field. As deployment team needs to pick from these the best suited for a new client.
Yes Business rules may be changed, as per very initial requirement from BA team, this also forced us to take new view for each component.
On top of this we are also using a static version control class for loading the user associated views
namespace web.mvc.Areas.HitMaster.Controllers
{
public class BMCsController : Controller
{
BMCList bm = new BMCList();
BMCDB bd = new BMCDB();
public ActionResult Index()
{
bm = bd.GetBMCs(5);
//using static class VersionControl to get components for user
return View(VersionControl.GetComponent(HttpContext.User.Identity.Name, ComponentName.RangePlanConfigSelection), null, bm);
}
}
}
AnilKr
Marked as answer by akfkmupiwu on Apr 12, 2012 12:52 PM
akfkmupiwu
Member
152 Points
72 Posts
Developing a Page Compositor in MVC 3
Apr 09, 2012 07:06 AM|LINK
Hi All,
We are developing web application based on ASP.net with MVC3. Our requirement is to compose/present a page dynamically based on a configuration saved by Administrator. We need to load multiple components (in our case partial views) dynamically for a module/screen. as per configuration (Deployment for a customer). The configuration file will look like.
Client Id
Configured Component
Client1
SelectionCriteria
SelectionCriteriaVer1Component
PlanningSection
PlanningSectionVer2Component
AnalysisSection
AnalysisSectionVer3Component
All these three will be construct a screen/page.
Client2
SelectionCriteria
SelectionCriteriaVer2Component
PlanningSection
PlanningSectionVer1Component
AnalysisSection
AnalysisSectionVer1Component
All these three will be construct a screen/page.
We are using partial views for each component and render logic is written in controller. We are using StructuredMap to achieve this for dependency injection. Please suggest better the approach if we are in wrong direction.
All comments are welcome.
partialviews
thinkrajesh
Participant
1356 Points
232 Posts
Re: Developing a Page Compositor in MVC 3
Apr 09, 2012 05:03 PM|LINK
This is good as per your requirement and I don't see any need to change anything. Except couple of question...
- Are you creating a new view for each client, even though the views differ in only couple of fields
- Do you create a view1 and view2, if both view1 and view2 has all the fields same except one. If yes wont' this create a huge collection of almost similar views even though individual elements hardly differ.
- Are there any sort of validation or business rules changes across almost similar views?
Hope these questions are valid in this context..
(Don't forget to click "Mark as Answer" on the post(s) that helped you.)
akfkmupiwu
Member
152 Points
72 Posts
Re: Developing a Page Compositor in MVC 3
Apr 10, 2012 06:23 AM|LINK
Thanks a lot Rajesh,
Your questions are very valid.
Yes we are planning to create new views even for small changes like adding/removing of single field. As deployment team needs to pick from these the best suited for a new client.
Yes Business rules may be changed, as per very initial requirement from BA team, this also forced us to take new view for each component.
akfkmupiwu
Member
152 Points
72 Posts
Re: Developing a Page Compositor in MVC 3
Apr 12, 2012 12:52 PM|LINK
On top of this we are also using a static version control class for loading the user associated views
namespace web.mvc.Areas.HitMaster.Controllers { public class BMCsController : Controller { BMCList bm = new BMCList(); BMCDB bd = new BMCDB(); public ActionResult Index() { bm = bd.GetBMCs(5); //using static class VersionControl to get components for user return View(VersionControl.GetComponent(HttpContext.User.Identity.Name, ComponentName.RangePlanConfigSelection), null, bm); } } }