asp.net mvc workshop for women in technology
TRANSCRIPT
@GosiaBorzecka
@GosiaBorzecka
.NET
ASP.NET
First application!
ASP.NET MVC
What’s next?
@GosiaBorzecka
@GosiaBorzecka
Little history of .NET
.NET 4.5
OpenSource!
@GosiaBorzecka
Microsoft spent many years since 1996 in building .NET Framework and then
.NET Framework evolved
It was July 2000 when Bill Gates appeared in a PDC (Professional Developers
Conference) Orlando Florida, where he revealed the detalis of Microsoft’s new
platform called NGWS (Next Generation Windows Service) later known as .NET
2002!
@GosiaBorzecka
Operating System
The OS manages the resources, the processes and
the users of the machine
Provides to the applications some services (threads,
I/O, GDI+, DirectX, COM, COM+, MSMQ, IIS, WMI, …)
@GosiaBorzecka
Operating System
Common Language Runtime
CLR manages the execution of the.NET code
Manages the memory, concurrency, security..
@GosiaBorzecka
Base Class
Library
Operating System
Common Language Runtime
Rich object-oriented library with fundamental classes
Input-output, collections, text processing, networking,
security, multi-threading..
@GosiaBorzecka
Base Class
Library
Dynamic Language Runtime
Operating System
Common Language Runtime
IronPython
IronRuby
@GosiaBorzecka
Base Class
Library
Dynamic Language Runtime
Portable Class
Library
Operating System
Common Language Runtime
Develop and build assemblies that work on multiple .NET Framework platform:
SilverLight Windows Phone Windows Store Xbox 360
@GosiaBorzecka
Base Class
Library
Dynamic Language Runtime
Portable Class
Library Win RT
Operating System
Common Language Runtime
@GosiaBorzecka
Base Class
Library
Dynamic Language Runtime
Managed Extensibility Framework
Portable Class
Library Win RT
Operating System
Common Language Runtime
Library for creating lightweight, extensible applications
It allows to discover and use extensions with no configuration required
@GosiaBorzecka
ASP.NET Windows
Desktop Apps ADO .NET
ADO.NET EF
WCF ASP.NET WEB API
Windows Store Apps
WPF Silver Light
Paraller Extension
SignalR WF LINQ
Base Class
Library
Languages (C#,
VB.NET..)
Dynamic Language Runtime
Managed Extensibility Framework
Portable Class
Library Win RT
Operating System
Common Language Runtime
@GosiaBorzecka
Visual Studio 2013
ASP.NET Windows
Desktop Apps ADO .NET
ADO.NET EF
WCF ASP.NET WEB API
Windows Store Apps
WPF Silver Light
Paraller Extension
SignalR WF LINQ
Base Class
Library
Languages (C#,
VB.NET..)
Dynamic Language Runtime
Managed Extensibility Framework
Portable Class
Library Win RT
Operating System
Common Language Runtime
@GosiaBorzecka
@GosiaBorzecka
@GosiaBorzecka
ASP.NET Web
Pages ASP.NET MVC
ASP.NET WEB
API
ASP.NET
SignalR
Entity
Framework
.NET Compiler
Platform
(“Roslyn”)
.NET Micro
Framework .NET MEF .NET Rx .NET WebClient
.NET Map
Reduce API for
Hadoop
.NET API for
Hadoop
Windows Azure
.NET SDK
Windows
Phone Toolkit
Xamarin
System
Drawing
Xamarin
Mobile
Xamarin
Mailkit Xamarin Auth
Xamarin
Mimekit
Xamarin
couchbase-
lite-net
Web Protection
Library
OWIN
Authentication
Middleware
LINQ to Hive
@GosiaBorzecka
@GosiaBorzecka
@GosiaBorzecka
@GosiaBorzecka
What is ASP.NET?
MVC
Web Forms
MVC
Web Pages
@GosiaBorzecka
.aspx
WYSIWYG (What You See Is What You Get) => drag&drop
@GosiaBorzecka
.cshtml
.vbhtml
Simple web development story
@GosiaBorzecka
MVC (Model – View – Controller)
Based on file and folder naming conventions
Easy to test, easy to TDD (Test Driven Development)
Based on the IoC (Inversion of Control)
@GosiaBorzecka
@GosiaBorzecka
@GosiaBorzecka
Demo
Short overview
@GosiaBorzecka
MVC application
Individual User Accounts
Shortcuts ◦ Start debugging (F5)
◦ Start without debugging (Ctrl+F5)
◦ Stop debugging (Shift+F5)
@GosiaBorzecka
@GosiaBorzecka
IIS Express ◦ It doesn't run as a service or require administrator
user rights to perform most tasks.
◦ IIS Express works well with ASP.NET and PHP applications.
◦ Multiple users of IIS Express can work independently on the same computer.
@GosiaBorzecka
BundleConfig.cs
New feature in ASP.NET 4.5
Easy to combine or bundle multiple files into a single file
Code optimalization (scripts, css)
@GosiaBorzecka
Filter.cs
Authorization
Action
Result
Exception
@GosiaBorzecka
@GosiaBorzecka
OnActionExecuting﴾ActionExecutedContext filterContext﴿; OnActionExecuted﴾ActionExecutingContext filterContext﴿; OnResultExecuting﴾ResultExecutingContext filterContext﴿; OnResultExecuted﴾ResultExecutedContext filterContext);
IdentityConfig.cs: ◦ User Account Definition
◦ Two-factor authentication (mail, sms)
◦ Account confimration (mail)
◦ Security token provider
◦ Logon with third part apps (Facebook, Twitter, Google)
@GosiaBorzecka
OWIN (Open Web Interface for .NET)
Project Katana: ◦ Portable
◦ Modular/flexible
◦ Lightweight/performant/scalable
@GosiaBorzecka
components for the application pipeline.
@GosiaBorzecka
RouteConfig.cs
@GosiaBorzecka
routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } );
@GosiaBorzecka
AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles);
Nuget
ASP.NET 5!
@GosiaBorzecka
Primary configuration file for any web services
@GosiaBorzecka
1. Demo
2. Short overview
3. Try yourself!
@GosiaBorzecka
@GosiaBorzecka
public
private
protected
internal
protected internal
@GosiaBorzecka
Read, write or compute a value of a private field Properties enable a class to expose a public way of getting and setting
values, while hiding implementation or verification code. A get property accessor is used to return the property value, and a set
accessor is used to assign a new value. These accessors can have different access levels. For more
information, see Restricting Accessor Accessibility ﴾C# Programming Guide﴿. The value keyword is used to define the value being assigned by the set
accessor. Properties that do not implement a set accessor are read only. For simple properties that require no custom accessor code, consider
the option of using autoimplemented properties. For more information, see Auto‐Implemented Properties ﴾C#
Programming Guide﴿.
@GosiaBorzecka
from Class
From Interface
@GosiaBorzecka
DbContext (represents contetnt of Web site)
DbSet (represents the collection of all entities in the context, or that can be queried from the database, of a given type)
@GosiaBorzecka
No boxing – unboxing
The most common use of generics is to create collection classes
Generic intefaces, classes, methods, events, delegates
◦ List<T>
◦ DbSet<TodoList>
@GosiaBorzecka
LINQ querying SQL (MS SQL Server supported).
LINQ querying Datasets (Querying is possible on Datasets and DataTables)
LINQ querying ORM Solution LINQ querying Objects (In-memory data may
be queried) LINQ querying XML (Querying is possible on
XML data source LINQ supports querying to those objects that
implement the IEnumerable Interface.
@GosiaBorzecka
@GosiaBorzecka
Details: ◦ Get task by id
Edit: ◦ Edit by id
◦ Post by collection
Delete: ◦ Delete by id
@GosiaBorzecka
TodoList todolist = db.TodoList.Find(id);
@GosiaBorzecka
Play!
Play!
Play!
@GosiaBorzecka
@GosiaBorzecka
@GosiaBorzecka
@GosiaBorzecka
@GosiaBorzecka
Twitter: @GosiaBorzecka
Facebook: GosiaBorzecka