using System;


Key features that Visual Studio provides for developing ASP.NET Core MVC projects

Add .NET packages to a project
Edit the dependencies section of the project.json file or use the NuGet tool

Add JavaScript or CSS packages to a project
Create a bower.json file and add the required packages to the dependencies section.

See the effect of view or class changes
Use the iterative development model.

Display detailed messages in the browser
Use developer exception pages

Get detailed information and control about application execution
Use the debugger

Reload one or more browsers using Visual Studio
Use Browser Link

Reduce the number of HTTP requests and the amount of bandwith required for JavaScript and CSS files
Use the Bundler & Minifier extension


Web API And Single-Page Applications

Create a RESTful web service
Add a Web API controller to an MVC Framework application

Map between HTTP methods and action names in a Web API controller
Apply attributes such as HttpPut and HttpPost to the methods

Create a single-page application
Use Knockout and jQuery to obtain data via Ajax and bind it to HTML elements



Define bundles
Create instances of the StyleBundle and ScriptBundle classes and add them to the bundle table

Prepare an application for bundles
Ensure that the Views/web.config file includes a reference for the System.Web.Optimization namespace

Add a bundle to a view or layout
Use the Styles.Render and Scripts.Render helpers

Enable concatenation and minification of bundles
Set the debug attribute of the compilation attribute in the Web.config file to false


Model Validation

Explicitly validate a model
Use the ModelState object to record validation errors

Generate a summary of validation errors
Use the Html.ValidationSummary helper method

Display property-level validation errors
Use the Html.ValidationMessageFor helper method

Define validation rules within the model class
Apply attributes to the properties of the model class

Create a custom validation attribute
Derive from the ValdiationAttribute class

Define a self-validating model
Implement the IValidatableObject interface

Use client-side validation
Add the Microsoft unobtrusive validation package to the application

Perform remote validation
Define an action method that returns a JsonResult and add the Remote attribute to the model property to be validated


Model Binding

Bind to a simple type or a collection
Add a parameter to an action method

Provide a fallback value for model binding
Use a nullable type for the action method parameter or use a default value

Bind to a complex type
Ensure that the HTML generated by your views contains nested property values

Override the default approach to locating nested complex types
Use the Prefix property Bind attribute applied to the action method parameter

Selectively bind properties
Use the Include or Exclude properties of the Bind attribute, applied either to the action method parameter or to the model class

Manually invoke model binding
Call the UpdateModel or TryUpdateModel methods

Create a custom value provider
Implement the IValueProvider interface

Create a custom model binder
Implement the IModelBinder interface


URL And Ajax Helper Methods

Generate links and URLs
Use the Url.Content, Url.Action, Url.RouteUrl, Html.ActionLink, Html.RouteLink helpers

Submit form data via Ajax
Use the unobtrusive Ajax package and the Ajax.BeginForm helper

Ensure that non-JavaScript browsers do not display HTML fragments
Set the Url Ajax option

Provide the user with feedback during an Ajax request
Use the LoadingElementId and LoadingElementDuration Ajax options

Prompt the user before making an Ajax request
Use the Confirm Ajax option

Create an Ajax enabled link
Use the Ajax.ActionLink helper

Receive notifications about the progress and outcome of Ajax callback requests
Use the Ajax callback options

Use JSON data in Ajax requests
Use the JsonResult action result

Detect Ajax requests in the controller
Use the Request.IsAjaxRequest method


Templated Helper Methods

Generate an element that can be used to edit a model property
Use the Html.Editor and Html.EditorFor helpers

Generate labels for and read-only representations of model properties
Use the Html.Label and Html.Display helpers

Generate elements for a complete model object
Use the DisplayForModel, EditorForModel and LabelForModel helpers

Hide an element from the user when generating elements using a whole-model helper or prevent it from being edited
Apply the HiddenInput attribute to the property

Set the label that will be used to display model properties
Use the DisplayName and Display properties

Specify the way in which model properties are displayed
Use the DataType attribute

Specify the template used to display a model property
Use the UIHint attribute

Define model metadata separately from the model type
Create a buddy class and use the MetadataType attribute

Change the elements that are generated for a model property
Create a custom template


Helper Methods

Create a region of reusable markup within a view
Create an inline helper

Create markup that can be used within multiple views
Create an external helper

Generate a form element
Use the Html.BeginForm and Html.EndForm helpers

Generate a form element using a specific route
Use the Html.BeginRouteForm helper

Generate input elements
Use the input helpers

Generate input elements from model objects
Use the strongly typed input helpers

Generate select elements
Use the DropDownList and ListBox helpers and their strongly typed counterparts



Create a custom view engine
Implement the IViewEngine and IView interfaces

Customize the Razor view engine
Derive from the RazorViewEngine class

Define regions of content for use in a layout
Use Razor sections

Apply sections in a layout
Use the RenderSection and RenderBody helpers

Define reusable fragments of markup
Use partial views

Define reusable business logic
Use child actions


Controller Extensibility

Create a custom controller factory
Implement the IControllerFactory interface

Prioritize namespaces in the default controller factory
Use the DefaultNamespaces collection

Create a custom controller activator
Implement the IControllerActivator interface

Create a custom action invoker
Implement the IActionInvoker interface

Specify an action name that is different from the action method name
Use the ActionName attribute

Control the selection of action methods
Apply action method selectors

Prevent a method from being used as an action
Use the NoAction attribute

Create a custom action method selector
Derive from the ActionMethodSelectorAttribute class

Respond to requests for non-existent action methods
Override the HandleUnknownAction method in the controller

Control how controllers use the session feature
Return a value from the SessionStateBehavior enumeration in the IControllerFactory implementation or apply the SessionState attribute to the controller class

Prevent controller from blocking worker threads when waiting for input
Create an asynchronous controller

Stariji postovi

<< 10/2017 >>




Powered by