Upload
marion-lambert
View
218
Download
0
Embed Size (px)
Citation preview
.NET 4.5, Just the good StuffWilliam TullochSenior ConsultantReadify
Mahesh Krishnan Principal ConsultantReadify
DEV215
A shameless plug
AgendaWhat are we going to cover?
The big pictureCore FrameworkWeb stuffThe three pillars of .NET 3.0 (WCF, WPF & WF)Other cool stuff
10 Years ago
A brief history of the .NET frameworkFe
brua
ry
2002
.NE
T 1.
0 Ap
ril
2003
.NE
T 1.
1
Janu
ary
2006
.NE
T 2.
0
Nov
embe
r 20
06 .N
ET
3.0
Nov
embe
r 20
07 .N
ET
3.5
April
20
10 .N
ET
4.0
Augu
st
2012
.NET 4.5
What has influenced this release?
Improving asynchronous operationsWindows 8 & WinRTNuGetPerformanceUsers’ Voice
Core Framework
async/await
Demo
A simple example
async/await
That was easy but …
All things asynchronous
Stream, TextWriter and TextReader have new async methods for expensive operations
Classes in System.Data.Common & System.Data.SqlClient now provide async methods
In WCF generating a proxy will create both synchronous and asynchronous operations by default
Identity
Since .NET 1.0 …
IIdentity
WindowsIdentity GenericIdentity FormsIdentity
The IIdentity interface public interface IIdentity{
string AuthenticationType{ get; }
bool IsAuthenticated{ get; }
string Name{ get; }}
Since .NET 1.0 …
IPrincipal
WindowsPrincipal GenericPrincipal FormsPrincipal
The IPrincipal interface public interface IPrincipal{
IIdentity Identity{ get; }
bool IsInRole(string role);}
Now in .NET 4.5
ClaimsIdentity
WindowsIdentity GenericIdentity FormsIdentity
IIdentity
The ClaimsIdentity classpublic class ClaimsIdentity : IIdentity{ //constructors removed to simply view // Properties public virtual string Name { get; } public virtual string AuthenticationType { get; } public virtual bool IsAuthenticated { get; }
public virtual IEnumerable<Claim> Claims { get; } public ClaimsIdentity Actor { get; set; } public object BootstrapContext { get; set; } public string Label { get; set; } public string NameClaimType { get; } public string RoleClaimType { get; }
//Helper methods for working with claims removed}
Now in .NET 4.5
ClaimsPrincipal
WindowsPrincipal GenericPrincipal FormsPrincipal
IPrincipal
The ClaimsPrincipal classpublic class ClaimsPrincipal : IPrincipal{ // Properties public virtual IIdentity Identity { get; } public virtual IEnumerable<Claim> Claims { get; } public static ClaimsPrincipal Current { get; } public virtual IEnumerable<ClaimsIdentity> Identities { get; }
public virtual bool IsInRole(string role); //Helper methods for claims removed}
A quick look at claims
Moving on from Role-based identity
AD in Windows Server 2012 can now export claims
Existing identity management doesn’t have to change for existing apps when upgrading to .NET 4.5
Windows Identity Foundation is now built into .NET 4.5
Portable Class Libraries
Portable Class Libraries
Some other things worth mentioning
Profile Optimisation and multicore JIT
Timeout support for regular expressions
New System.IO.Compression namespace
WeakReference<T>
Culture definition for the application domain
All things web
Web API
Http programming model – helps in writing RESTful appsFull support for routes
Content negotiation
Query composition
Can be self-hosted
Creating a simple REST service
Working with the HttpClient
Web Sockets
Web Sockets
Full duplex, bi-directional communication
Built on HTTP, thus can traverse firewalls and proxies
Supports binary and UTF-8 payloads
Supported in WinRT, IE10, IIS 8, ASP.NET 4.5 and WCF 4.5on Windows 8 and Windows Server 2012
ASP.NET
Web forms
Strongly typed data controls and model binding
Improved async support
Built-in minification and bundling of Javascript & CSS
Server controls updated for HTML 5
…
MVC 4
Razor enhancementsChanges to the template Async controller actionsImproved support for mobile development …
ASP.NET
The pillars of .NET 3.0
WCF
What’s new in WCF
Easier to ConfigureProxies define async methods by defaultCan create explicit task-based async operations WebSockets and UDP protocols supportedWCF support for Windows 8 apps
Using WCF in a Windows 8 app
WPF
What’s new in WPF
The Ribbon ControlValidating data asynchronouslyData Binding Changes
Delay property bindingBinding to static properties
Markup extensions for events…
Workflow Foundation
What’s in new in WF
C# expressions
Contract-first workflow services
Workflow versioning - WorkflowIdentity
Authoring & designer improvements
Other cool stuff
MEF 2.0
MEF 2.0
Support for open generic parts
Convention-based registration
Composition scoping enhancements
Diagnostic improvements
MEF for Metro & web apps
MEF in Windows 8
The TPL
What’s new in the TPL
Performance
New methods
Run()
Delay()
WhenAny()
WhenAll()
FromResult()
The Progress<T> class
TPL Dataflow
What is TPL Dataflow (TDF)?
“TPL Dataflow (TDF) is a new .NET library for building concurrent applications. It promotes actor/agent-oriented designs through primitives for in-process message passing, dataflow, and pipelining. TDF builds upon the APIs and scheduling infrastructure provided by the Task Parallel Library (TPL), and integrates with the language support for asynchrony provided by C#, Visual Basic, and F#.”
TDF is …
A set primitives referred to as blocks
A block essentially consists of a queue/buffer and a Task
Some examples of blocks are:
ActionBlock
TransformBlock
BufferBlock
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the
part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.