March 18th, 2009

ASP.NET MVC 1.0 now Live!

ASP.NET MVC 1.0 is now Live.  You can download it right now here.  Also check out Phil Haack’s post on the release.  If you are new to MVC, please check out our previous posts for more information and links to many useful blogs and resources.  Alternatively, check out the official site for tutorials, videos, and more.

MSDN Documentation for MVC is also now available: http://go.microsoft.com/fwlink/?LinkId=145989

Since ASP.NET MVC RC1 we made some changes to the set of properties available to T4 templates – many names have changed (for clarity and consistency) and some properties are no longer available (because the same information is available through other properties).  See the following table for the full list of properties available to templates:

Add Controller:

Property Name

Type

Description

ControllerName

System.String

The name of the Controller class, including the ‘Controller’ suffix

Namespace

System.String

The namespace into which the Controller is being generated

AddActionMethods

System.Boolean

Indicates whether or not the user checked the option in the Add Controller dialog to get extra action methods

ControllerRootName

System.String

The name of the controller class without the ‘Controller’ suffix

Add View:

Property Name

Type

Description

ViewName

System.String

The name of the view (without extension), as typed in the Add View dialog

Namespace

System.String

The default namespace of the view’s parent folder

IsPartialView

System.Boolean

Evaluates to true if the user chose a partial view in the Add View dialog

IsContentPage

System.Boolean

Evaluates to true if the user is creating a view with a master page

MasterPageFile

System.String

Path to the master page the user chose in the dialog (to be used only when IsViewContentPage is true)

PrimaryContentPlaceHolderID

System.String

Name of the primary content place holder into which the generated content will be placed. This is the content place holder id the user typed into the Add View dialog

ContentPlaceHolderIDs

System.Collections.Generic.List<System.String>

A list of all content place holder ID’s in the master page, if a master page was chosen for this view

OutputFileExtension

System.String

The output file’s extension (including the period)

ViewDataTypeName

System.String

Name of the type to which a strongly-typed view is bound

ViewDataType

System.Type

This is a Type object representing the type to which a strongly-typed view is bound. It can be used to get information on the properties in the type and the like

The following properties were removed:

Property Name

Type

Description

IsViewPage

System.Boolean

This property was used to tell whether a page was a regular view page (that is, not a partial view and not a content page).  However, the same information can be gathered by simply checking to see if IsPartialView and IsContentPage are both false.

ViewDataTypeGenericString

System.String

This property was used to output the generic clause for the ‘Inherits’ attribute in the View’s directive for strongly-typed views.  For example, in C# it would output “<MyType>” and in VB it would output “(Of MyType)”.  We moved this logic of outputting the generic clause to the T4 templates and instead added the ‘ViewDataTypeName’ property to provide just the type name.

Have fun!

Abhishek Mishra | Software Design Engineer | Visual Studio Web Developer

0 comments

Discussion are closed.