Your SlideShare is downloading. ×
Programming is Fun with ASP.NET MVC
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Programming is Fun with ASP.NET MVC


Published on

A basic overview of Microsoft ASP.NET MVC and why it is a great platform to develop with.

A basic overview of Microsoft ASP.NET MVC and why it is a great platform to develop with.

Published in: Software

1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Programming is Fun With ASP.NET MVC! Ian Carnaghan
  • 2. Page  2 Programming is Fun with ASP.NET MVC Introduction to ASP.NET What is ASP.NET?  ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting.  It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology.  ASP.NET supports three different development models: Web Pages, MVC (Model View Controller), and Web Forms.
  • 3. Page  3 ASP.NET Visual Studio 2012 Programming is Fun with ASP.NET MVC The ASP.NET Framework ASP.NET Web Forms ASP.NET MVC ASP.NET Web Pages Web Forms View Engine Razor View Engine WebMatrix What is ASP.NET?  Web Pages is the Simplest ASP.NET model. Similar to PHP and classic ASP with built-in templates and helpers for database, video, graphics, social media and more.  MVC separates web applications into different different components and provides a lighter weight framework, separation of concerns and DRY approach to development.  Webforms is the traditional ASP.NET event driven development model. Web pages with added server controls, server events, and server code.
  • 4. Page  4 Programming is Fun with ASP.NET MVC IIS SQL Server Entity Framework ASP.NET JS & JQuery The Microsoft Web Platform Internet Information Services is the web server used by ASP.NET applications. EF is an Object Relational Mapper (ORM) – the layer that converts DB elements such as tables and views to objects uses in the application. ASP.NET MVC comes with JavaScript libraries, jQuery and HTML 5 support. ASP.NET can use a range of databases, however SQL Server is the most popular has great support in Visual Studio. ASP.NET is the development framework.
  • 5. Page  5 Programming is Fun with ASP.NET MVC Model View Controller MVC Model–view–controller (MVC) is a software architecture pattern which separates the representation of information from the user's interaction with it. It was introduced by Trygve Reenskaug at Xerox Parc in 1976.  Model represents the data and business logic such as database tables, constraints and validations.  View represent the screens the users access. The view uses data from the model to provide information to the user.  Controller handles requests sent in by the user and determines what actions need to be taken by the application.
  • 6. Page  6 Programming is Fun with ASP.NET MVC Interactions Follow Natural Cycle: 1. User takes action 2. Application changes data model 3. Updated view sent to user Different Technologies MVC compatible with combining other technologies into tiers or layers. Full Control over UI New Razor View Engine provides greater control and cleaner code. No Viewstate requirement with auto- generated code –100s Kb smaller. Total control over requests sent netween server and browser. User Experience HTML 5 Technologies, Non-Obtrusive JS, Routing,. Maintainability Modern coding Standards Convention over configuration. Similar to other popular MVC Frameworks including Grails, Ruby on Rails, Spring MVC, Monorail and many others. Maintainablility DRY approach to programming Testability Since the UI is completely seperated from the business logic, it is easier to unit tests. Multiple Unit testing framworks available. Why Microsoft ASP.NET MVC?
  • 7. Page  7 Programming is Fun with ASP.NET MVC C:InetpubwwwrootWebsitePerson.aspx Physical Location ASP.NET Style MVC Style Routing  Routing in MVC comes packages with easy to configure rules based on different circumstances.  By default {ControllerName}/{MethodName}/(optional Id)  Many URLs can link to the same controller via different methods
  • 8. Page  8 Programming is Fun with ASP.NET MVC Code First  Preferred by programmers who do not want to work with designers and EDMX.  Full control (no autogenerated code).  Seperation from DB, regardless of technology. The ORM will handle creation.  Manual changes to DB problematic and lost since code defines the database. Database First  Best choice if you already have DB designed by DBAs.  ORM creates entities for you to use in your application.  Manual changes to the database are possible - update model from database Model First  Preferred by people interested in building a site with least amount of coding.  Use design tools – Partial loss of control on both entities and database  Can be very productive for small easy projects.  Manual changes to DB problematic and lost since model defines the database. Architectural Options for Developing an Application
  • 9. Page  9 Programming is Fun with ASP.NET MVC Person Entity:  Id (int)  FirstName (string)  LastName (string)  BirthDate (datetime) Context:  People (Collection of Person)  Using ASP.NET DbContext library for Entity Framework Person Model  Index Method – Call existing records from model to pass to a list view  Create Method – Provide empty model to pass to a create view and handle posts  Edit Method – Call an existing record via the model to pass to an edit view and handle posts  Details Page – Call an existing record via the model to pass to a display view Person Controller  Person/Index  Person/Create  PersonEdit  Person/Details Person Views Simple CRUD (Create Read Update Delete) Application The Object Relational Mapper enables communication between the application and database and converts database elements into application-ready objects. ASP.NET uses Entity Framework and a .Net Library called DbContext for this process. DbContext enables you to query a database and group together changes that will then be written back to the store as a unit.
  • 10. Page  10 Programming is Fun with ASP.NET MVC Simple CRUD (Create Read Update Delete) Application
  • 11. Page  11 Programming is Fun with ASP.NET MVC  Office of Population Affairs was a legacy ColdFusion Application, which was redesigned using ASP.NET and launched in April 2013.  Application required versioning of records, logging, approvals and extensive search.  Twitter Bootstrap was used for the frontend layout providing a responsive HTML 5 compliant design.  Solr libraries integrated with ASP.NET via SolrNET.  MVC 4 using Code First Entify Framework Implementation with SQL Server and IIS. Office of Population Affairs Boot strap Apache Solr ASP.NET MVC 4 & EF
  • 12. Page  12 Programming is Fun with ASP.NET MVC Domain Model  Object representation of the physical database tables  Validation and contraints are defined here and used throughout the application Repositories  Heavy lifting work of performing all transactions needed from the application layer to the database  Mapping between Domain objects and View Model objects Abstraction Layer  Interfaces the controllers can use to perform repository actions.  Provides an additional layer of seperation – if major changes occur in repository – the controllers are not dependent upon them. View Models  Subsets of the Domain Model, proving view specific information.  Example public Organization Details only contains specific fields. OPA Application Structure
  • 13. Page  13 Programming is Fun with ASP.NET MVC Community Health Online Resource Center Ajax-based CDC Application  Resource database of records tagged in various categories.  Full-text searching and AJAX front- end for user interaction.  Back-end administration for managing resources and adding users to maintain the database.  Integration into CDC PIV Card authentication via C# Active Directory libraries.
  • 14. Page  14 Programming is Fun with ASP.NET MVC  National Diabetes Education Program  Application will share code-base for the CHORC  Records listing with thumbnails and integration with NDEP API for adding resources to external cart.  Monarch Academy web-based Curriculum Mapping.  CM for Expeditionary Learning  Maintainable by Administrators, Accessible by all Teachers  Based on Education Research Future Projects
  • 15. Page  15 Programming is Fun with ASP.NET MVC   Pluralsight is by and far the best Microsoft Development Training Site!  ICF may pay for the yearly subscription via Training or Tuition Reimbursement  Check out Julie Lerman  30242369  Work through the Sports Store tutorial!  Great indepth explanations  Keep as good reference guide   Check out his other videos at various conferences  Subscribe to Hanselminutes Podcasts  Also check out .Net Rocks! Learning Resources for ASP.NET MVC 4 * Oh and did I mention Stackoverflow!?
  • 16. Page  16 Do You Have Any Questions?