Module 9(comprog)

Cards (15)

  • MVC Framework
    Model-View-Controller Framework
  • MVC Framework
    • Separates an application into three main components: the model, the view, and the controller
    • A lightweight but a powerful presentation framework that is integrated with existing features of the ASP.NET
  • Model
    Objects that are part of the application that implements the logic for the application's data domain. Model objects are used to store and retrieve a database's state model and handles the business logic of the application
  • View
    Component objects used to display the user interface of an application. This user interface is typically created from the model data
  • Controller
    The application's component objects that handle user interaction, work with the model, and select a view to render that displays the user interface. In an MVC app, the view only displays information while the controller handles and responds to the input and interaction of the user. The input logic is handled by the controller
  • Advantages of MVC-Based Web Applications
    • Complexity management makes it easier by separating an application into the model, the view, and the controller
    • Full Control allows developers to take full control over an application's behavior because it does not use view state or server-based forms
    • Rich Routing Infrastructure allows applications to use a Front Controller pattern that is used to process requests through a single controller
    • Test-Driven Development (TDD) can be accomplished by repeatedly modifying and testing a source code. The MVC framework provides better support for TDD
  • Features of ASP.NET MVC Frameworks
    • Separating of Application Tasks into the three main components, as well as their testability and TDD. Each of the core contract in the MVC framework are interface-based and can be tested by using simulated objects
    • An Extensible and Pluggable Framework contains components designed in a way that they can be replaced or customized easily. It also supports the use of two container models: Dependency Injection (DI) and Inversion of Control (IOC)
    • Extensive Support for ASP.NET Routing is a powerful URL-mapping component that can create applications that have searchable and comprehensible URLs. These URLs do not have to include file name extensions
  • ASP.NET Support Features
    • URL Authorization: Users and roles are mapped to URLs in ASP.NET applications
    • Membership and Roles: Used by services to authenticate and authorize clients
    • Output and Data Caching: Achieved by keeping a copy of the page or fragment that was sent in response to a request in memory
    • Session and Profile State Management: ASP.NET provides a way to save values by using session state for each active Web application session and profile state for storing user-specific data
    • Health Monitoring: Enables system administrators to monitor the status of deployed Web apps
    • Configuration System: Used to describe the properties and behaviors of different ASP.NET applications
    • Provider Architecture: ASP.NET can be configured to store state virtually anywhere; this aims to make ASP.NET state storage to be both flexible and extensible
  • ASP.NET Authentication Options
    • No Authentication: applications do not require any user authentication
    • Individual User Accounts: recommended for applications that store user profiles in a SQL Server database. Users can sign up or sign in using their existing account for Microsoft, Facebook, Twitter, Google, or another provider
    • Organizational Accounts: recommended for applications that require authentication from users with Active Directory, Windows Azure Active Directory, or Office 365 accounts
    • Windows Authentication: application will be configured to use the Windows Authentication IIS module for authentication. The application will show the Active Directory's domain and user ID or local machine account that is logged into Windows but won't include user registration or log-in UI. This is recommended for intranet/LAN applications
  • MVC Request Life Cycle
    Takes care of requests with an MVC framework. Involves three phases: Routing, Controller, and View
  • Routing
    A pattern matching system that registers one or more patterns with the framework's route table to tell the routing system what to do with requests matching the patterns
  • MapRoute()
    An extension method that runs during application startup, located in App_Start/RouteConfig.cs. In addition to providing a name and URL pattern, it also defines a set of default parameters to be used in the event that the URL fits the route pattern, but doesn't actually provide values for every segment
  • Controllers
    Responds to user input and collaborates between the model, view, and data access layers. To process a request, the controller's methods (called controller actions) are called by the routing framework
  • Action Parameters
    Allows controllers to specify parameters that MVC populates using information from a request upon execution via a process called model binding
  • Views
    Used by controller actions that wish to display HTML to the user return an instance of ViewResult. When it's time to render the view, the ASP.NET MVC Framework will look for the view using the name provided by the controller. Located at the Views folder of the root directory of a website