SlideShare a Scribd company logo
ASP.NET MVC CRUSH COURSE 2ERDEM ERGİN
Restful ASP.NET MVCUygulamamızda PUT ve DELETE metotlarını destekleyebilir miyiz?HTML formları sadece GET ve POST destekler !!!<input name="X-HTTP-Method-Override" type="hidden" value="DELETE" />
AsynchronousActionsUzun sürecek bir işlem için IIS thread’ini meşgul etmemek performansı arttırır.Kullanıcı açısından değişiklik olmaz !!!Controller yerine AsyncControllersınıfından türetmek gerekpublic void ActionNameAsync(...) public ActionResultActionNameCompleted(...)
Default Editor TemplatesBoolean – check-box or 3-state drop-down Collection – iterate and show editor (with name style “*n+”) Decimal – text box (with formatting) HiddenInput – hidden input MultilineText – text area Object – edit all simple properties Password – text box (password) String, Text – text box
DefaultDisplay TemplatesBoolean – disabled checkbox or 3-state drop-down Collection – iterate and display Decimal – encoded text (with formatting) EmailAddress – auto-linked (with mailto:) HiddenInput – encoded text Html – unencoded text Object – show all simple properties String, Text – encoded text Url – auto-linked
Custom TemplatesDisplaytemplates: ~/Areas/AreaName/Views/ControllerName/DisplayTemplates/ ~/Areas/AreaName/Views/Shared/DisplayTemplates/ ~/Views/ControllerName/DisplayTemplates/ ~/Views/Shared/DisplayTemplates/ Editor templates: ~/Areas/AreaName/Views/ControllerName/EditorTemplates/ ~/Areas/AreaName/Views/Shared/EditorTemplates/ ~/Views/ControllerName/EditorTemplates/ ~/Views/Shared/EditorTemplates/
Templates SelectionAlgorithmModelMetadata.TemplateHintModelMetadata.DataTypeNameConcrete type name (stripping nullable) Simple type? … String … or interface? … Collection (if it implements IEnumerable) Object … or complex type? Iterate over all base concrete types (stopping before Object) Collection (if it implements IEnumerable) Object
Custom T4 TemplatesWHAT: Generates View and Controller files  DEFAULT: <vsdir>Common7\IDE\ItemTemplates\CSharp\Web\MVC 2\CodeTemplatesWHY: Add your own to generate Views and Controllers based on your needsCopyCodeTemplates folder in you solution
Server-sideValidationRulesWHAT: Definehow a propertyisvalidated in the server side validationDEFAULT: Required, Length, wrong typeWHY: Add your own rulesWrite a new ValidationAttributeImplement the IsValid methodApply attribute to your model
Client-sideValidationRulesWHAT: Definehow a propertyisvalidated in the client-side validationDEFAULT: Client-sidecounterparts of the default server-side validatorsWHY: Addyourownvalidators
Client-sideValidationRulesFirst make a server-side validatorMakevalidationlogic in JavaScriptWriteadaptertopushvalidationrulesto client-sideRegistervalidationfunction via JSRegisteradapter in Global.asax
HtmlHelpersWHAT: Utility functions that hide away the generation of HTML markup or JavaScript codeDEFAULT: Html.TextBox, Html.Encode, Html.Partial, …WHY: “If there is an if, write an Helper”Add new methods as extension methods
TeşekkürlerErdem Ergin@erdemergin

More Related Content

PPTX
Introduction To JavaScript
PPT
Asp.net mvc
PPT
PHP coding tips and review guides
PDF
Programming style
PPTX
Sencha / ExtJS : Object Oriented JavaScript
PDF
Workshop 2: JavaScript Design Patterns
Introduction To JavaScript
Asp.net mvc
PHP coding tips and review guides
Programming style
Sencha / ExtJS : Object Oriented JavaScript
Workshop 2: JavaScript Design Patterns

What's hot (20)

PPTX
Introduction to JavaScript
PDF
TypeScript for Java Developers
PPT
JavaScript Modules in Practice
PPT
Zend framework 02 - mvc
PDF
iOS best practices
PPT
Web development basics (Part-4)
PPT
How to learn to build your own PHP framework
PPT
Zend Framework 2 - PHPUnit
PPTX
Getting started with typescript
ODP
Spray - Build RESTfull services in scala
PPTX
Introduction to java script
PPT
Backbone js
PDF
Workshop 3: JavaScript build tools
DOC
Introduction to java script
PPT
Js ppt
PPT
Vbscript
PDF
Javascript Best Practices
PPTX
Session 3 Java Script
PPTX
Introduction to JavaScript Programming
PPT
vb script
Introduction to JavaScript
TypeScript for Java Developers
JavaScript Modules in Practice
Zend framework 02 - mvc
iOS best practices
Web development basics (Part-4)
How to learn to build your own PHP framework
Zend Framework 2 - PHPUnit
Getting started with typescript
Spray - Build RESTfull services in scala
Introduction to java script
Backbone js
Workshop 3: JavaScript build tools
Introduction to java script
Js ppt
Vbscript
Javascript Best Practices
Session 3 Java Script
Introduction to JavaScript Programming
vb script
Ad

Viewers also liked (14)

PPTX
Citizen engagement finalproject
PPT
2010_07_01_NMV_PrezentaceLangerova
PDF
Google Apps Security whitepaper
PPTX
Relationship survey
PPT
As christmas revision3
PPT
Economic Directions of Northern Mindanao for 2011
PDF
Canadian
PPT
Slide Show Test
PPTX
Relationship survey
PDF
Canadian
PDF
Issa de' mar Miami Swim week sponsor deck
PPT
Tutorial membuat interpolasi ch
DOCX
Asp.net mvc ve jquery ile sunucudan json verisi okuma
PPTX
Asp.net mvc
Citizen engagement finalproject
2010_07_01_NMV_PrezentaceLangerova
Google Apps Security whitepaper
Relationship survey
As christmas revision3
Economic Directions of Northern Mindanao for 2011
Canadian
Slide Show Test
Relationship survey
Canadian
Issa de' mar Miami Swim week sponsor deck
Tutorial membuat interpolasi ch
Asp.net mvc ve jquery ile sunucudan json verisi okuma
Asp.net mvc
Ad

Similar to Asp.net MVC - Course 2 (20)

PPTX
MVC & SQL_In_1_Hour
PDF
Working Effectively With Legacy Perl Code
ODP
Drupal Best Practices
KEY
Geek Moot '09 -- Smarty 101
PDF
Intro To Mvc Development In Php
ODP
Practical catalyst
PDF
Web internship Yii Framework
PPTX
Introduction to c_plus_plus (6)
PPTX
Introduction to c_plus_plus
PPTX
Retrofit Web Forms with MVC & T4
PPT
Smoothing Your Java with DSLs
PPTX
Asp.Net MVC Intro
PPTX
Asp.net mvc training
PPTX
Asp.NET MVC
PDF
Symfony2 - from the trenches
PDF
AEM Sightly Deep Dive
ODP
Built-in query caching for all PHP MySQL extensions/APIs
PDF
Intro to Laravel 4
PPT
Introduction to ASP.NET MVC
PPT
SQL Server 2005 CLR Integration
MVC & SQL_In_1_Hour
Working Effectively With Legacy Perl Code
Drupal Best Practices
Geek Moot '09 -- Smarty 101
Intro To Mvc Development In Php
Practical catalyst
Web internship Yii Framework
Introduction to c_plus_plus (6)
Introduction to c_plus_plus
Retrofit Web Forms with MVC & T4
Smoothing Your Java with DSLs
Asp.Net MVC Intro
Asp.net mvc training
Asp.NET MVC
Symfony2 - from the trenches
AEM Sightly Deep Dive
Built-in query caching for all PHP MySQL extensions/APIs
Intro to Laravel 4
Introduction to ASP.NET MVC
SQL Server 2005 CLR Integration

Asp.net MVC - Course 2

  • 1. ASP.NET MVC CRUSH COURSE 2ERDEM ERGİN
  • 2. Restful ASP.NET MVCUygulamamızda PUT ve DELETE metotlarını destekleyebilir miyiz?HTML formları sadece GET ve POST destekler !!!<input name="X-HTTP-Method-Override" type="hidden" value="DELETE" />
  • 3. AsynchronousActionsUzun sürecek bir işlem için IIS thread’ini meşgul etmemek performansı arttırır.Kullanıcı açısından değişiklik olmaz !!!Controller yerine AsyncControllersınıfından türetmek gerekpublic void ActionNameAsync(...) public ActionResultActionNameCompleted(...)
  • 4. Default Editor TemplatesBoolean – check-box or 3-state drop-down Collection – iterate and show editor (with name style “*n+”) Decimal – text box (with formatting) HiddenInput – hidden input MultilineText – text area Object – edit all simple properties Password – text box (password) String, Text – text box
  • 5. DefaultDisplay TemplatesBoolean – disabled checkbox or 3-state drop-down Collection – iterate and display Decimal – encoded text (with formatting) EmailAddress – auto-linked (with mailto:) HiddenInput – encoded text Html – unencoded text Object – show all simple properties String, Text – encoded text Url – auto-linked
  • 6. Custom TemplatesDisplaytemplates: ~/Areas/AreaName/Views/ControllerName/DisplayTemplates/ ~/Areas/AreaName/Views/Shared/DisplayTemplates/ ~/Views/ControllerName/DisplayTemplates/ ~/Views/Shared/DisplayTemplates/ Editor templates: ~/Areas/AreaName/Views/ControllerName/EditorTemplates/ ~/Areas/AreaName/Views/Shared/EditorTemplates/ ~/Views/ControllerName/EditorTemplates/ ~/Views/Shared/EditorTemplates/
  • 7. Templates SelectionAlgorithmModelMetadata.TemplateHintModelMetadata.DataTypeNameConcrete type name (stripping nullable) Simple type? … String … or interface? … Collection (if it implements IEnumerable) Object … or complex type? Iterate over all base concrete types (stopping before Object) Collection (if it implements IEnumerable) Object
  • 8. Custom T4 TemplatesWHAT: Generates View and Controller files DEFAULT: <vsdir>Common7\IDE\ItemTemplates\CSharp\Web\MVC 2\CodeTemplatesWHY: Add your own to generate Views and Controllers based on your needsCopyCodeTemplates folder in you solution
  • 9. Server-sideValidationRulesWHAT: Definehow a propertyisvalidated in the server side validationDEFAULT: Required, Length, wrong typeWHY: Add your own rulesWrite a new ValidationAttributeImplement the IsValid methodApply attribute to your model
  • 10. Client-sideValidationRulesWHAT: Definehow a propertyisvalidated in the client-side validationDEFAULT: Client-sidecounterparts of the default server-side validatorsWHY: Addyourownvalidators
  • 11. Client-sideValidationRulesFirst make a server-side validatorMakevalidationlogic in JavaScriptWriteadaptertopushvalidationrulesto client-sideRegistervalidationfunction via JSRegisteradapter in Global.asax
  • 12. HtmlHelpersWHAT: Utility functions that hide away the generation of HTML markup or JavaScript codeDEFAULT: Html.TextBox, Html.Encode, Html.Partial, …WHY: “If there is an if, write an Helper”Add new methods as extension methods