ASP. NET view engine collation

Source: Internet
Author: User
Tags classic asp

1. ASPX View Engine

The first is also our most familiar---aspx, I believe that has done webform development for the ASPX are more familiar with:



Small example:

<%@ Control inherits= "system.web.mvc.viewpage<ienumerable<product>>"%>
%>
<ul> 
    In model) {%>
    <li><%=p.name%></li>      
    <%}%>
</ul> 
<%}else{%> 
    <p>no products available</P>    
<%}%>

Design goal:

A view engine that renders the output of a Web Froms page.

Advantages:
• Tightly integrated with ASP. NET MVC
• Better experience for previous ASP.
• Intelligent Sensing
• CodeDom provider that can select other languages (e.g. C #, vb.net, F #, Boo, Nemerle)
• Compile now or precompile views

Disadvantages:
• Easy to mix with the classic ASP. NET MVC in ASP. NET MVC is no longer supported by ASP. (Example: ViewState PostBack)
• "tag groups" that can help with anti-patterns
• Smart inductive forced styles are always not inline blocks of code.
• Clutter when designing simple templates.

2. Razor View

Introduced in the ASP. 3 version, it can support unittest and is easy to get started.

Advantages:
• Compact structure and smooth expression
• Easy to learn
• Is not a new language
• Have a good sense of intelligence
• Unit Testing possible
• Ubiquitous integration in ASP. NET MVC

Disadvantages:
• Create a slightly lightweight "tag regiment" problem. Server-side tags actually provide the structure code around the server and non-server-side code, razor confusing HTML and server-side code, pure HTML and JS development challenging (See concrete example # # #), you end up having to "escape" the HTML and/ or JavaScript tags in some common situations.
• Package Reuse Poor: this is impractical to invoke the razor template as if it were a common method-razor code that can be called in practice, but otherwise it can encourage mixed code and render content.
• syntax is HTML-oriented content that can be tricky to generate. In spite of this, Razor's data model is really just string concatenation, syntax and nesting errors, neither static nor dynamic, although the vs.net design helps mitigate this point of certainty. Maintainability and reconfigurable are also limited by this.

Example code # #

@{
    String[] teammembers = {"Robert"};
    In teammembers)
    {
        <p> @person </p>
    }
}


3. Hasic

Hasic is an ASP. NET MVC engine with vb.net ' s XML literals

Advantages:
• Check for valid XML at compile time
• Syntax Coloring
• Full IntelliSense
• Compiling views
• Extensibility using regular CLR classes, functions, etc.
• Seamless combination and manipulation, even if it is a common vb.net code
• Can be unit tested

Disadvantages:
• Performance: Build the entire DOM and send it to the client.

Example:

As XElement
    Return _
    <body>
        
    </body>
End Function


Learn More

4. Bellevue

Bellevue is a prototype of an ASP. NET MVC framework, with HTML as its core without more syntax.

• Follow the HTML language instead of "just text".
• Don't mess with my html! The code from the HTML data binding should be detached.
• Perform a rigorous model-view separation


Learn More

5. Spark View Engine

Another interesting view engine for ASP. NET MVC and Castle Project Monorail framework

Design goal:
The idea is to allow the HTML to dominate the stream and code to fit seamlessly.

Advantages:
• Generate more readable templates
C# IntelliSense (VS2008 no ReSharper)
sparksense Plug-in VS2010 (with ReSharper)
• Provide a powerful binding feature to get rid of all the code in your views and allow you to easily create your own HTML tags

Disadvantages:
• No explicit separation of template logic from literal tags (this can mitigate namespace prefixes)

Example:

< products= "ienumerable[[product]]"/>  
<If= "products. Any () ">  
    < each= ' var p in products '>${p.name}</li>    
</ul> 
<else> 
    <p>no products available</P>    
</Else> 
<Style= "">  
    < for/> 
    < for/> 
    < forMessage/>  
</Form> 



Want to learn more or download.

6. Brail View

The Brail View Engine is a migrated from monorail project with the goal of being applied to the ASP. NET MVC framework. It is located in the Mvccontrib Project: a basic project.

Learn More

7. Sharptiles

Sharptiles is a template view Engine built on the ASP. NET MVC and monorail framework. Its concept is partially ported from the Jstl and tiles frameworks.

Learn more.

8. Nhaml

Design objectives:
. NET platform is ported from the Rails Haml view engine. From Haml's official website:

Haml is a markup language that is used to clean and simply describe the XHTML of any Web document that does not use inline code ... Haml avoids the need to explicitly encode XHTML into a template, because it is actually an abstract description of XHTML, some code to generate dynamic content.

Advantages:
• Concise structure (e.g.: D. R.y.)
• Good indent
• Clear Structure
C# IntelliSense (VS2008 no ReSharper)

Disadvantages:
• A concept from XHTML abstraction that allows you to use other familiar tags than
No IntelliSense in vs2010

Example:

@type =ienumerable<product>
if (model. Any ())
  %ul
    In model)
      %li= P.name
Else
  %p No Products available

ASP. NET view engine collation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.