Page tree

The informational material contained in this section is provided as a courtesy for use by CAST’s clients. The material in this section is not considered part of any CAST product’s official Documentation. CAST does not warrant that the information is current or that it addresses all potential issues. Licensing details are documented on this page: https://www.gnu.org/licenses/lgpl-3.0.en.html

Skip to end of metadata
Go to start of metadata



Target Audience: CAST Administrators

 

Summary: This document provides a guide based on CAST’s field experience on how to configure Spring based applications using CAST AIP. These configurations are used over and above CAST AIP 8.2.x ASP.NET MVC offering (see Reference Materials below for links) to overcome limitations such as missing links. The applicability of this guide should have assessed for newer versions of CAST AIP and Extension.



Introduction to ASP.NET MVC

This section gives a brief overview of the framework.
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly.



Features:

  1. Separation of application tasks (input logic, business logic, and UI logic), testability, and test-driven development (TDD). All core contracts in the MVC framework are interface-based and can be tested by using mock objects, which are simulated objects that imitate the behavior of actual objects in the application. You can unit-test the application without having to run the controllers in an ASP.NET process, which makes unit testing fast and flexible. You can use any unit-testing framework that is compatible with the .NET Framework.
  2. An extensible and pluggable framework. The components of the ASP.NET MVC framework are designed so that they can be easily replaced or customized. You can plug in your own view engine, URL routing policy, action-method parameter serialization, and other components. The ASP.NET MVC framework also supports the use of Dependency Injection (DI) and Inversion of Control (IOC) container models. DI enables you to inject objects into a class, instead of relying on the class to create the object itself. IOC specifies that if an object requires another object, the first objects should get the second object from an outside source such as a configuration file. This makes testing easier.
  3. Extensive support for ASP.NET routing, which is a powerful URL-mapping component that lets you build applications that have comprehensible and searchable URLs. URLs do not have to include file-name extensions, and are designed to support URL naming patterns that work well for search engine optimization (SEO) and representational state transfer (REST) addressing.
  4. Support for using the markup in existing ASP.NET page (.aspx files), user control (.ascx files), and master page (.master files) markup files as view templates. You can use existing ASP.NET features with the ASP.NET MVC framework, such as nested master pages, in-line expressions (<%= %>), declarative server controls, templates, data-binding, localization, and so on.

Support for existing ASP.NET features. ASP.NET MVC lets you use features such as forms authentication and Windows authentication, URL authorization, membership and roles, output and data caching, session and profile state management, health monitoring, the configuration system, and the provider architecture.

The MVC framework includes the following components:
Models. Model objects are the parts of the application that implement the logic for the application's data domain. Often, model objects retrieve and store model state in a database. For example, a Product object might retrieve information from a database, operate on it, and then write updated information back to a Products table in a SQL Server database.
In small applications, the model is often a conceptual separation instead of a physical one. For example, if the application only reads a dataset and sends it to the view, the application does not have a physical model layer and associated classes. In that case, the dataset takes on the role of a model object.
Views. Views are the components that display the application's user interface (UI). Typically, this UI is created from the model data. An example would be an edit view of a Products table that displays text boxes, drop-down lists, and check boxes based on the current state of a Product object.
Controllers. Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. For example, the controller handles query-string values, and passes these values to the model, which in turn might use these values to query the database.

Versions of ASP.NET MVC Framework supported by CAST

This section highlights the ASP.NET MVC Framework versions supported by CAST AIP version 8.3.x.

  • ASP.NET MVC** 1.x/2.x/3.x/4.x/5.x for ASP.NET MVC based application

File Types expected for CAST Analysis

This section highlights all the file types that can be expected to be delivered if the application has implemented this framework.

  • cshtml
  • cs
  • vbhtml
  • vb

ASP.NET MVC

How to identify the implementation of ASP.NET MVC:

This section details the approach for identifying the presence of ASP.NET MVC in the code delivered.

The following approaches can be used to identify ASP.NET MVC:

1.  The .csproj file in the source code will contain the following entries:


This is a reference entry which will contain entry for System.Web.Mvc.dll

2. There will be a RouteConfig.cs file containing the RegisterRoutes.


ASP.NET MVC Description:

This section gives a brief overview of ASP.NET MVC

ASP.NET MVC adds separation of application tasks (input logic, business logic, and UI logic), testability, and test-driven development (TDD). All core contracts in the MVC framework are interface-based and can be tested by using mock objects, which are simulated objects that imitate the behavior of actual objects in the application. You can unit-test the application without having to run the controllers in an ASP.NET process, which makes unit testing fast and flexible. You can use any unit-testing framework that is compatible with the .NET Framework.
ASP.NET MVC is an extensible and pluggable framework. You can plug in your own view engine, URL routing policy, action-method parameter serialization, and other components. The ASP.NET MVC framework also supports the use of Dependency Injection (DI) and Inversion of Control (IOC) container models. DI enables you to inject objects into a class, instead of relying on the class to create the object itself. IOC specifies that if an object requires another object, the first objects should get the second object from an outside source such as a configuration file. This makes testing easier.
Extensive support for ASP.NET routing, which is a powerful URL-mapping component that lets you build applications that have comprehensible and searchable URLs. URLs do not have to include file-name extensions, and are designed to support URL naming patterns that work well for search engine optimization (SEO) and representational state transfer (REST) addressing.
Support for using the markup in existing ASP.NET page (.aspx files), user control (.ascx files), and master page (.master files) markup files as view templates. You can use existing ASP.NET features with the ASP.NET MVC framework, such as nested master pages, in-line expressions (<%= %>), declarative server controls, templates, data-binding, localization, and so on.
Support for existing ASP.NET features. ASP.NET MVC lets you use features such as forms authentication and Windows authentication, URL authorization, membership and roles, output and data caching, session and profile state management, health monitoring, the configuration system, and the provider architecture.
execution of an MVC application takes place when there is a certain request from the client. The following diagram illustrates the flow.

Step 1 − The client browser sends request to the MVC Application.

Step 2 − Global.ascx receives this request and performs routing based on the URL of the incoming request using the RouteTable, RouteData, UrlRoutingModule and MvcRouteHandler objects.

Step 3 − This routing operation calls the appropriate controller and executes it using the IControllerFactory object and MvcHandler object's Execute method.

Step 4 − The Controller processes the data using Model and invokes the appropriate method using ControllerActionInvoker object

Step 5 − The processed Model is then passed to the View, which in turn renders the final output.

How to configure ASP.NET MVC in CAST AIP:

This section describes all the CAST configuration steps to be followed in order to configure ASP.NET MVC based application. 
The CAST configuration steps given below are based on the code snippets showing a typical transaction flow such as    ASP (View)> Controller (Model)> Database.
The Controller is mandatory for ASP.NET MVC frameworks.  Note that there can be multiple type of code implementation styles.


MVC to DB2 1. Flow start from “RegDocumentUpload.cshtml” form. Document.ready event calling -> GetCusipListOnCompanyNameAndCusipId (belongs to RegDocHostingController) calling -> GetCusipListOnCompanyNameAndCusipId (belongs to DataFacade class) calling -> GetCusipListOnCompanyAndCusipId (belongs to WebApiServiceClient class)

2. GetCusipListOnCompanyAndCusipId (belongs to WebApiServiceClient class) calling -> WebApiMethod (belongs to FileHostingWebApi inheriting the property of IFileHostingWebApi interface) calling -> ExecutePostWebApi (belongs to same class implemented from IFileHostingWebApi) calling -> ExecuteFileHostingWebApi (belongs to same class) calling -> Execute (belongs to RestClient system defined class) -> WebAPI is getting called.

3. WebAPI execution GetCusipListOnCompanyAndCusipId (belongs to FileHostingController) -> SearchCusipListOnCompanyAndCusipId (belongs to FileHostingService class implemented from IFileHostingService interface) calling -> SearchCusipListOnCompanyAndCusipId (belongs to Db2AccessProvider class) -> calling DB2 procedure, hence end point of the flow.


Server Manager Configuration

This section describes the Server Manager Configuration Steps.
There are no specific configuration for ASP.NET MVC Framework in server manager.

Pre Analysis Configuration

NA


Enlighten

This Section gives an overview of the Enlighten diagram.

ASP.NET MVC FLOW WITH CSHTML TO DATABASE


CMS Configuration

This Section describes the CMS Configuration which is required to set ASP.NET MVC Framework in CAST. 

SyntaxRegular ExpressionCode snippet

'@Url.Action("PlanDetail", "Home", new { planId = "__id__"})'

'\@Url.Action\("([a-zA-Z0-9_\/]+)"(,(\s+)?")?([a-zA-Z0-9_\/]+)?


@using (Html.BeginForm("PlanPreview", "Home", FormMethod.Post, new { autocomplete = "off" }))

 

\@using\s\([a-zA-Z0-9_\/]+.[a-zA-Z0-9_\/]+\("([a-zA-Z0-9_\/]+)",(\s+)?"([a-zA-Z0-9_\/]+)"

 

Html.RenderAction(“ReviewAccountAction”, “Enroll”, new {AccountInfo=Model.PlanEnrollmentInfo})

Html.RenderAction\("([a-zA-Z0-9_\/]+)",(\s+)?"([a-zA-Z0-9_\/]+)"

 

Jquery

$.get(‘/Enroll/AccountSection’, {})

\$\.get\s?\('\/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)

 

@Ajax.ActionLink(‘Edit’, “DividentOptions”,  new {})

\@Ajax.ActionLink\s?\("[a-zA-Z0-9]+\"+,\s?\"([a-zA-Z0-9]+)"

 

@Url.Action ("ActionName", "Controller Name")

@Url.Action\(\"([a-zA-Z0-9_]+)\",\s\"([a-zA-Z0-9_]+)\"

AjaxCall ("URL", {Other Properties}) - Where URL is an action method path “/VoteSource/GetVoteSourceFundsList”

 

AjaxCall\(\"/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)",

 


@using (Html.BeginForm ("Action Name", "Controller Name", FormMethod.Post, new {autocomplete = "off"}))

 

@using\s\(\Html.BeginForm\(\"([a-zA_Z0-9_]+)",\s"[a-zA-Z0-9_)]+"

 

‘@Url.Action ("MultipleSaves")';

 

@Url.Action\(\"([a-zA-Z0-9_]+)"\)'

 


 

@Html.ActionLink ("Caption", "ActionName")

 

@Html.ActionLink\(\"([a-zA-Z0-9_\s]+)",\s\"([a-zA-Z0-9_]+)"\)

 

@Html.ActionLink ("Caption", "ActionName", "Controller Name")

 

@Html.ActionLink\(\"([a-zA-Z0-9_]+)\",\s\"([a-zA-Z0-9_]+)\",\s\"([a-zA-Z0-9_]+)\"

 



Syntax

Regular Expression

Code Snippet


















<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id=<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="e9066d37-ff9f-46c0-97ce-8340535bd7d8"><ac:parameter ac:name="">_GoBack</ac:parameter></ac:structured-macro>"bbde553e-1cf8-4291-b217-2a00a1391542"><ac:plain-text-body><![CDATA[

















'@Url.Action("PlanDetail", "Home", new { planId = "{}id{}"})'


















'@Url.Action("([a-zA-Z0-9_\/])"(,(\s)?")?([a-zA-Z0-9_\/]+)?


































@using (Html.BeginForm("PlanPreview", "Home", FormMethod.Post, new { autocomplete = "off" })) <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="efef3d9d-9f84-49e7-9ba7-dc3ee8c2ba5a"><ac:plain-text-body><![CDATA[ 


































@using\s([a-zA-Z0-9_\/].[a-zA-Z0-9_\/]("([a-zA-Z0-9_\/])",(\s)?"([a-zA-Z0-9_\/]+)" ]]></ac:plain-text-body></ac:structured-macro> 

















 


















<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a29a4686-0a88-42de-b585-7564f6fdfe77"><ac:plain-text-body><![CDATA[

















Html.RenderAction("ReviewAccountAction", "Enroll", new {AccountInfo=Model.PlanEnrollmentInfo})


















Html.RenderAction("([a-zA-Z0-9_\/])",(\s)?"([a-zA-Z0-9_\/]+)"
















]]></ac:plain-text-body>
</ac:structured-macro> 



















Jquery - <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c8090e1d-63bf-416c-a3c6-8df6ae10b16c"><ac:plain-text-body><![CDATA[$.get('/Enroll/AccountSection', {})


































\$\.get\s?('\/([a-zA-Z0-9])/([a-zA-Z0-9]) ]]></ac:plain-text-body></ac:structured-macro> 

















 


















<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="76ccd3b4-9783-4323-913e-b53ae00e6c97"><ac:plain-text-body><![CDATA[

















@Ajax.ActionLink('Edit', "DividentOptions",  new {})


















@Ajax.ActionLink\s?("[a-zA-Z0-9]\",\s?\"([a-zA-Z0-9]+)" ]]></ac:plain-text-body>

















</ac:structured-macro> 



















<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7d52d50d-4d99-4d22-992e-730a6c70963f"><ac:plain-text-body><![CDATA[

















@Url.Action ("ActionName", "Controller Name")


















@Url.Action({color}
"([a-zA-Z0-9_])\",

































\s\"([a-zA-Z0-9_])\"



































AjaxCall ("URL", {Other Properties}) - Where URL is an action method path "/VoteSource/GetVoteSourceFundsList" <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="99bb575b-6c38-406b-b556-41f827506b07"><ac:plain-text-body><![CDATA[ 


































AjaxCall(\"/([a-zA-Z0-9_])/([a-zA-Z0-9_])", ]]></ac:plain-text-body></ac:structured-macro> 

















 


















@using (Html.BeginForm ("Action Name", "Controller Name", FormMethod.Post, new {autocomplete = "off"})) <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="aafc0320-fb46-4981-bb4c-0c683e27c314"><ac:plain-text-body><![CDATA[ 


































@using\s(\Html.BeginForm(\"([a-zA_Z0-9_])",\s"[a-zA-Z0-9_)]" ]]></ac:plain-text-body></ac:structured-macro> 

















 


















'@Url.Action ("MultipleSaves")'; <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3f243d19-d9c9-4ba2-b055-9e54e4ec06ba"><ac:plain-text-body><![CDATA[ 


































@Url.Action(\"([a-zA-Z0-9_]+)")' ]]></ac:plain-text-body></ac:structured-macro> 

















 


















@Html.ActionLink ("Caption", "ActionName") <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2dba8171-3764-4bef-9af3-3421c1f67bf0"><ac:plain-text-body><![CDATA[ 


































@Html.ActionLink(\"([a-zA-Z0-9_\s])",\s\"([a-zA-Z0-9_])") ]]></ac:plain-text-body></ac:structured-macro> 

















 


















@Html.ActionLink ("Caption", "ActionName", "Controller Name") <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="fed93429-542c-4a6f-b0df-0f679853ecd6"><ac:plain-text-body><![CDATA[ 


































@Html.ActionLink(\"([a-zA-Z0-9_])\",\s\"([a-zA-Z0-9_])\",\s\"([a-zA-Z0-9_]+)\" ]]></ac:plain-text-body></ac:structured-macro> 

















 

Pattern 1:
Cast Architecture flow:

TCC Configuration:

This Section describes the TCC configuration which needs to be set. 

1.CSHTML as Entry Point for AIP <8.0 


By Type for AIP >8.0


2. All public Controller Methods which are not called by Cshtml can be set as Entry Points




3. All Controller Methods can be set as Entry Points (Preferred is the above two Entry Points)


Reference Materials

Reference ID

 

1

*ASP.NET MVC* Documentation (Cast Documentation)

2

*ASP.NET MVC* MVC (Cast Documentation)





  • No labels