Introduction to .NET Florin Olariu

Slides:



Advertisements
Similar presentations
INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC.
Advertisements

ARCH-13 Developing WebSpeed  Applications Chris Skeldon Principal Consultant.
Fabian Vilers Hands on ASP.NET MVC.
ASP MVC s/mvc-4/getting-started-with- aspnet-mvc4/intro-to-aspnet- mvc-4.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
UNIT-V The MVC architecture and Struts Framework.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse 2.
LAYING OUT THE FOUNDATIONS. OUTLINE Analyze the project from a technical point of view Analyze and choose the architecture for your application Decide.
MVC pattern and implementation in java
ASP. Net is a rich web framework that leverages well known patterns and JavaScript frameworks to build great web experiences quickly.
ASP.NET and Model View Control Jesper Tørresø ITNET2 F08.
Todd Snyder Development Team Lead Infragistics Experience Design Group.
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
1 Another group of Patterns Architectural Patterns.
Design Patterns: Structural Design Patterns
Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Architecture.
REST - Introduction Based on material from InfoQ.com (Stefan Tilkov) And slides from MindTouch.com (Steve Bjorg) 1.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Integrating Modeling Tools in the Development Lifecycle with OSLC Miami, October 2013 Adam Neal (Presenter) Maged.
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
Getting started with ASP.NET MVC Dhananjay
MVC WITH CODEIGNITER Presented By Bhanu Priya.
SEA Side – Extreme Programming 1 SEA Side Software Engineering Annotations Architectural Patterns Professor Sara Stoecklin Director of Software Engineering-
Implementation Struts Framework for well-architectured web applications Model-View-Controller design pattern.
Introduction  “M” “V” “C” stands for “MODEL” “VIEW” “CONTROLLER”. ASP.NET MVC is an architecture to develop ASP.NET web applications in a different manner.
ASP.NET MVC An Introduction. What is MVC The Model-View-Controller (MVC) is an architectural pattern separates an application into three main components:
Text INTRODUCTION TO ASP.NET. InterComm Campaign Guidelines CONFIDENTIAL Simply Server side language Simplified page development model Modular, well-factored,
Testing WebForms w/ Model-View-Presenter Erik Peterson.
ASP.NET Core* Shahed Chowdhuri Sr. Technical WakeUpAndCode.com A Quick Overview of ASP.NET Core * aka ASP.NET 5 before.
Intro to MVC5 Bryan Soltis Bit-Wizards - Director of Technology & Research.
Modern Development Technologies in SharePoint SHAREPOINT SATURDAY OMAHA APRIL, 2016.
ASP.NET Core* Shahed Chowdhuri Sr. Technical WakeUpAndCode.com A Quick Overview of ASP.NET Core RC2 * aka ASP.NET 5 before.
BIT 286: Web Applications ASP.Net MVC. Objectives Applied MVC overview Controllers Intro to Routing Views ‘Convention over configuration’ Layout files.
Model View Presenter Design Pattern Jay Smith PMO Architect and Evangelist Tyson Foods, Inc.
Introduction to.NET Florin Olariu & Andrei Arusoaie “Alexandru Ioan Cuza”, University of Iai Department of Computer Science.
Introduction to .NET Florin Olariu
Design Patterns Source: “Design Patterns”, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides And Created.
Building production ready APIs with ASP.NET Core 2.0
Social Media And Global Computing Introduction to The MVC Pattern
Department of Computer Science
Software Architecture & Difference from Design
MVC Architecture, Symfony Framework for PHP Web Apps
WEB SERVICES.
ASP.NET MVC Introduction
Unit – 5 JAVA Web Services
Software Design and Architecture
Building Web Applications with Microsoft ASP
CMPE 280 Web UI Design and Development October 24 Class Meeting
Unit 6-Chapter 2 Struts.
CO6025 Advanced Programming
SharePoint Cloud hosted Apps
Presented by Igor Ivković
Model-View-Controller Design Pattern
ASP.NET Web Forms Vs. ASP.NET MVC ASP.NET is Microsoft’s big leap after Active Server Pages (ASP), ASP.NET provides flexible and unified web development.
Top Reasons to Choose Angular. Angular is well known for developing robust and adaptable Single Page Applications (SPA). The Application structure is.
Design and Maintenance of Web Applications in J2EE
A Quick Overview of ASP.NET Core 1.0
Model-View-Controller (MVC) Pattern
ASP.NET Core* MVC and Web API Shahed Chowdhuri
What’s new in ASP.NET Core and Entity Framework 2.2 (Preview 3)
Direct Manipulation.
HCI Project.
Implementing Security in ASP.NET Core: Claims, Patterns, and Policies
Building production-ready APIs with ASP.NET Core 2.2
Web API with Angular 2 Front End
Introduction to .NET Florin Olariu
Presented by Igor Ivković
ASP.NET and Model View Control
Chengyu Sun California State University, Los Angeles
ASP.NET Core Middleware Fundamentals
Presentation transcript:

Introduction to .NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science

ASP.NET Web API

Agenda Demo : create an empty API project Using middleware for building an API Demystify MVC pattern Demo: Adding ASP.NET Core MVC middleware Demo : Returning resources (1) Learning about routing Demo : Returning resources (2) Demo : Improving the architecture with model classes The importance of status codes Demo : Returning correct status codes Summary

Demo : create an empty API project Fix the compatibility issues using proper SDK’s(1.0 vs 1.1)

Using middleware for building an API In order to e able to build an API we have to add some extensions for the configure services into Startup.cs. If we would do a step back to the previous versions:

Using middleware for building an API ASP.NET Web API (Angular http services)

Using middleware for building an API ASP.NET Web API (Angular http services) ASP.NET MVC (client-facing web applications) We had in the previous versions a separation between Web API framework and MVC. In .NET Core those are unified into one framework.

Using middleware for building an API ASP.NET Web API (Angular http services) ASP.NET MVC (client-facing web applications) ASP.NET Core MVC We had in the previous versions a separation between Web API framework and MVC. In .NET Core those are unified into one framework. Now this is a rich framework meant to build web applications using MVC pattern => Model-View-Controller.

Demystify MVC pattern MVC is an acronym and stands from:

Demystify MVC pattern Model-View-Controller It is an architectural software pattern for implementing user interfaces.

Demystify MVC pattern Model-View-Controller Architectural pattern It is an architectural software pattern for implementing user interfaces.

Demystify MVC pattern Model-View-Controller Architectural pattern Used for: low coupling, separation of concerns The result are: testability and code reuse.

Demystify MVC pattern Model-View-Controller Architectural pattern Used for: low coupling, separation of concerns It is not a FULL APPLICATION ARCHITECTURE. Why is not full application architecture? Because when we are speaking about a full architecture we have to keep in mind the following: business layer, data layer etc.

Demystify MVC pattern Model – handles the data for the application. In same application the model doesn’t contain any logic (behavior) => there is another component for this=> like business layer.

Demystify MVC pattern View – handles display of data. It might be html for instance.

Demystify MVC pattern View – handles display of data. It might be html for instance.

Demystify MVC pattern Controller -> handles the interaction between the view and the model including user input.

Demystify MVC pattern Controller -> handles the interaction between the view and the model including user input. See dependencies. -> next slide.

Demystify MVC pattern Controllers and views depends on the model. But …

Demystify MVC pattern Controller depends on the view as well. But why we are discussing about MVC when the main subject is : Web API? The answer is simple: an API is actually the “presentation of data”. How an API works?

Demystify MVC pattern An consumer of API (another application) makes a request to the controller.

Demystify MVC pattern An consumer of API (another application) makes a request to the controller. The controller return a model to the view. The model is a Resource representation.

Demo: Adding ASP.NET Core MVC middleware

Demo : Returning resources (1)

Learning about routing What is routing?

Learning about routing Matches request URI to controller method When a request is sent, the MVC parses the URI and tries to map the request to a controller method. In order to solve this there 2 methods:

Learning about routing Matches request URI to controller method Convention based and attribute based routing

Learning about routing Matches request URI to controller method Convention based and attribute based routing Convention based app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); For API, MVC team recommends not using convention based. Instead the recommendation is attribute based routing.

Learning about routing Matches request URI to controller method Convention based and attribute based routing Attribute based Attributes at controllers/actions level Let’s have a look at the most common attributes.

Learning about routing

Demo : Returning resources (2)

Demo : Improving the architecture with model classes

The importance of status codes What is status code?

The importance of status codes Is a part of a response What is status code?

The importance of status codes Is a part of a response Provides information on:

The importance of status codes Is a part of a response Provides information on: Whether or not the response worked as expected

The importance of status codes Is a part of a response Provides information on: Whether or not the response worked as expected Who is responsible for a failed request (consumer or our API)

The importance of status codes

Demo : Returning correct status codes

One more thing…(1/2) Postel’s law.

One more thing…(2/2) Postel’s Law: “Be conservative in what you do, be liberal in what you accept from others.” Postel’s Law is a clever bit of social engineering. Also known as the Robustness Principle.

Summary Status codes MVC How to build a proper API Routing

Bibliography Pluralsight

Questions Do you have any other questions?

Thanks! See you next time! 