SlideShare ist ein Scribd-Unternehmen logo
1 von 16
HattanShobokshi ASP.NET MVC Best Practices
Housekeeping Stuttering is a communication disorder involving disruptions, or “disfluencies,” in a person’s speech. Across all cultures, roughly 1% of people currently has a stuttering disorder. http://westutter.org/
HattanShobokshi Senior Software Engineer www.hattanshobokshi.com hattan@gmail.com http://speakerrate.com/hattanhttp://www.slideshare.net/shobokshi Who am I?
Look at Examples of BAD CODE PRG Pattern Load JavaScript files from CDN Do not Include view formatting in the controller  T4 Templates  Custom View & Controller Templates  Diagnostic Tools  Telerik Grid Control Goals for this talk
PRG Pattern HTTP POST Redirect HTTP GET The prg pattern is used to ensure that the intended modification of data only happens once.
Content Delivery Network Improve Application Performance Reuse Javascript files Cached by different domains Available Content Files: jQuery jQuery Validation jQuery UI Ajax Control Toolkit ASP.NET Ajax ASP.NET MVC JavaScript Files  http://www.asp.net/ajaxlibrary/cdn.ashx<script src='http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.min.js' type='text/javascript'></script>  Microsoft AjaxContent Delivery Network
T4 : Text Template Transformation Toolkit Code Generation Tool  Built into Visual Studio (2008 and 2010) .tt File Extension  No syntax highlighting by default Clarius Visual T4 Add-onhttp://www.visualt4.com/ Tip: Windows 7/Vista unblock zip file, unblock individual files  More informationhttp://www.olegsych.com/2007/12/text-template-transformation-toolkit/
T4MVC T4 template for ASP.NET MVC Creates strongly typed helpers Eliminates magic strings (View names, HtmlHelper parameters) Download via NuGet or http://mvccontrib.codeplex.com/wikipage?title=T4MVC http://blogs.msdn.com/b/davidebb/archive/2010/03/12/a-better-way-to-auto-run-t4mvc-when-you-build.aspx
T4MVC <%= Html.ActionLink(“New Dinner", “Create", "Dinners")%> <%= Html.ActionLink(" New Dinner", MVC.Dinners.Create())%> <imgsrc="/Content/nerd.jpg" /> <imgsrc="<%= Links.Content.nerd_jpg %>" /> http://mvccontrib.codeplex.com/wikipage?title=T4MVC_doc
Custom Tooling Customize Default View Templates Add new View Templates Customize Controller Template T4 Templates ~icrosoft Visual Studio 10.0ommon7DEtemTemplatesSharpebVC 2 ~icrosoft Visual Studio 10.0ommon7DEtemTemplatesisualBasicebVC 2 T4 Code Templates
Add Reference to Dll Enable route debugging with 1 line of codeRouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes); http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx Route Debugger
MVC Diagnostics Environment Information MVC Assembly Version Referenced Assembly Information Web Forms page, not an mvc page http://bradwilson.typepad.com/blog/2010/03/diagnosing-aspnet-mvc-problems.html
Telerik Grid Control http://demos.telerik.com/aspnet-mvc/ Grid Control Out of the box support for Sorting, Filtering Out of the box paging support Out of the box ajax support Very little javascript you have to write! 
What did we just talk about? Look at Examples of BAD CODE PRG Pattern Load JavaScript files from CDN Do not Include view formatting in the controller  T4 Templates  Custom View & Controller Templates  Diagnostic Tools  Telerik Grid Control
Contact Information Email: hattan@gmail.com www.hattanshobokshi.com
The End Thank you!

Weitere ähnliche Inhalte

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

ASP.NET MVC Best practices

  • 2. Housekeeping Stuttering is a communication disorder involving disruptions, or “disfluencies,” in a person’s speech. Across all cultures, roughly 1% of people currently has a stuttering disorder. http://westutter.org/
  • 3. HattanShobokshi Senior Software Engineer www.hattanshobokshi.com hattan@gmail.com http://speakerrate.com/hattanhttp://www.slideshare.net/shobokshi Who am I?
  • 4. Look at Examples of BAD CODE PRG Pattern Load JavaScript files from CDN Do not Include view formatting in the controller T4 Templates Custom View & Controller Templates Diagnostic Tools Telerik Grid Control Goals for this talk
  • 5. PRG Pattern HTTP POST Redirect HTTP GET The prg pattern is used to ensure that the intended modification of data only happens once.
  • 6. Content Delivery Network Improve Application Performance Reuse Javascript files Cached by different domains Available Content Files: jQuery jQuery Validation jQuery UI Ajax Control Toolkit ASP.NET Ajax ASP.NET MVC JavaScript Files http://www.asp.net/ajaxlibrary/cdn.ashx<script src='http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.min.js' type='text/javascript'></script> Microsoft AjaxContent Delivery Network
  • 7. T4 : Text Template Transformation Toolkit Code Generation Tool Built into Visual Studio (2008 and 2010) .tt File Extension No syntax highlighting by default Clarius Visual T4 Add-onhttp://www.visualt4.com/ Tip: Windows 7/Vista unblock zip file, unblock individual files More informationhttp://www.olegsych.com/2007/12/text-template-transformation-toolkit/
  • 8. T4MVC T4 template for ASP.NET MVC Creates strongly typed helpers Eliminates magic strings (View names, HtmlHelper parameters) Download via NuGet or http://mvccontrib.codeplex.com/wikipage?title=T4MVC http://blogs.msdn.com/b/davidebb/archive/2010/03/12/a-better-way-to-auto-run-t4mvc-when-you-build.aspx
  • 9. T4MVC <%= Html.ActionLink(“New Dinner", “Create", "Dinners")%> <%= Html.ActionLink(" New Dinner", MVC.Dinners.Create())%> <imgsrc="/Content/nerd.jpg" /> <imgsrc="<%= Links.Content.nerd_jpg %>" /> http://mvccontrib.codeplex.com/wikipage?title=T4MVC_doc
  • 10. Custom Tooling Customize Default View Templates Add new View Templates Customize Controller Template T4 Templates ~icrosoft Visual Studio 10.0ommon7DEtemTemplatesSharpebVC 2 ~icrosoft Visual Studio 10.0ommon7DEtemTemplatesisualBasicebVC 2 T4 Code Templates
  • 11. Add Reference to Dll Enable route debugging with 1 line of codeRouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes); http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx Route Debugger
  • 12. MVC Diagnostics Environment Information MVC Assembly Version Referenced Assembly Information Web Forms page, not an mvc page http://bradwilson.typepad.com/blog/2010/03/diagnosing-aspnet-mvc-problems.html
  • 13. Telerik Grid Control http://demos.telerik.com/aspnet-mvc/ Grid Control Out of the box support for Sorting, Filtering Out of the box paging support Out of the box ajax support Very little javascript you have to write! 
  • 14. What did we just talk about? Look at Examples of BAD CODE PRG Pattern Load JavaScript files from CDN Do not Include view formatting in the controller T4 Templates Custom View & Controller Templates Diagnostic Tools Telerik Grid Control
  • 15. Contact Information Email: hattan@gmail.com www.hattanshobokshi.com

Hinweis der Redaktion

  1. C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\ItemTemplates\\CSharp\\Web\\MVC 2 &lt;h2&gt;&lt;#= mvcHost.ViewName #&gt;&lt;/h2&gt;