first look at visual studio 2010 and net framework 4 0
Download
Skip this Video
Download Presentation
First look at Visual Studio 2010 and .NET Framework 4.0

Loading in 2 Seconds...

play fullscreen
1 / 67

First look at Visual Studio 2010 and .NET Framework 4.0 - PowerPoint PPT Presentation


  • 180 Views
  • Uploaded on

First look at Visual Studio 2010 and .NET Framework 4.0. Ken Casada Developer Evangelist Microsoft Switzerland [email protected] http://blogs.msdn.com/swiss_dpe_team/Default.aspx. Introduction. 3.5. 3.0. .NET 1.0. .NET 1.1. .NET 2.0. .NET 4.0. 2002. 2003. 2005-08. ~ < 2009.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' First look at Visual Studio 2010 and .NET Framework 4.0' - zephr-horton


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
first look at visual studio 2010 and net framework 4 0

First look at Visual Studio 2010 and .NET Framework 4.0

Ken Casada

Developer Evangelist

Microsoft Switzerland

[email protected]

http://blogs.msdn.com/swiss_dpe_team/Default.aspx

introduction
Introduction

3.5

3.0

.NET 1.0

.NET 1.1

.NET 2.0

.NET 4.0

2002

2003

2005-08

~ < 2009

CLR 1.0

CLR 1.1

CLR 2.0

CLR 4.0

existing side by side sxs
Existing Side-By-Side (SxS)

1.1 add-in

2.0 add-in

3.0 add-in

3.5 add-in

3.5

.NET 1.1

3.0

.NET 2.0

Host Process (e.g. Outlook)

in process side by side sxs
In-Process Side-By-Side (SxS)

2.0 add-in

3.0 add-in

3.5 add-in

4.0 add-in

3.5

.NET 4.0

3.0

.NET 2.0

Host Process (e.g. Outlook)

net dynamic programming
.NET DynamicProgramming

Dynamic vs. Static

c and visual basic
C# and Visual Basic

Focusing on language co-evolution…

slide7

Parallel Programming

Parallel Extensions is a .NET Library that supports declarative and imperative data parallelism, imperative task parallelism, and a set of data structures that make coordination easier.

  • Parallel LINQ (PLINQ)
  • Task Parallel Library (TPL)
  • Coordination Data Structures (CDS)

Parallel Extension June 2008 CTP

net framework 4 0 client
.NET Framework 4.0: Client
    • Client Profile
  • Windows Presentation Foundation
    • Business focused controls
      • DataGrid, DatePicker, VSM

 Today part of the WPF Toolkit (update in March 09)

 http://www.codeplex.com/wpf

      • After .NET 4.0  More controls (Chart controls, …)
    • Silverlight Synergy
      • DeepZoom in WPF 4.0 has been cut
    • Deploy Full-Trust XBAP: ClickOnceelevation prompt isenabledfor (XBAPs) in Intranet and Trusted Zones.
    • And More: text enhancements for much clearer text rendering, …
multi touch
Multi-Touch
  • Windows 7 Multi-Touch API
  • WPF 4.0 Multi-Touch API and Controls
    • Base WPF controls updated to be multi-touch aware
    • Multi-Touch specific new controls
    • Surface SDK 2.0 built on top of WPF 4.0

Windows 7 RC Training Kit for Developers

Just Released!!!

wcf 4 0 demo summary
WCF 4.0 (Demo Summary)
  • Simplified Configurations
    • No more need for <service> tag to configure a service.
    • Default Endpoints for each base Address and implemented contract
  • Standard Endpoints
    • mexEndpoint
    • webHttpEndpoint
    • discoveryEndpoint

…and more…

<system.serviceModel>    <services>        <service name=“MyService"><endpointkind="mexEndpoint" />        </service>    </services> </system.serviceModel>

 pre-defined endpoints that have one or more of their properties (address, binding, contract) fixed.

wcf 4 0 demo summary1
WCF 4.0 (DemoSummary)
  • Enables file less activation (no .svc)

in case of IIS-WAS hosted Web Services!!!

<system.serviceModel>

<serviceHostingEnvironment>

<serviceActivations>

<add relativeAddress="/MyService.svc" service="ServiceTypeName"/>

<add relativeAddress="/MyService" service="ServiceTypeName"/>

</serviceActivations>

</serviceHostingEnvironment>

</system.serviceModel>

wcf 4 0
WCF 4.0
  • Service Discovery (WS-Discovery)
    • Ad-hoc discovery (multicast)

 clients can discover services on a local subnet (UDP-based)

    • Proxy-managed discovery (unicast)

 clients can discover services on a larger "managed" network (beyond the local subnet) through a discovery proxy (dedicated network resource). Allow you to locate services no matter whey are.

    • Announcements
      • You can add an announcement endpoint (standard Endpoint: udpAnnouncementEndpoint), which guarantees that the service will send an online and offline announcement when the service is opened and closed respectively. As a service consumer you get notified when the service endpoints go on- and offline.
    • WCF Service Discovery HOL available within the WCF-WF 4 Beta 1 Training Kit: http://code.msdn.microsoft.com/wcfwf4)
wcf 4 01
WCF 4.0
  • Improved REST support
    • Many features from the WCF REST Starter Kit will become part of WCF 4.0.

 WCF REST Starter Kit Preview 2 available on Codeplex

  • Correlation enhancements
    • Content and context driven
  • Integration with Workflow Services
  • Router Service supporting
    • Content-based routing
      • Able to perform message filtering based on the content contained within the message (SOAP header/message body)
    • Protocol Bridging
wcf 4 0 demo summary2
WCF 4.0 (DemoSummary)
  • Create a CalculatorService listening at
  • http://localhost:8000/servicemodelsamples/service
  • Create a RoutingService (of type RountingService)listeningathttp://localhost:8000/routingservice/router
  • Create a RoutingTable within the app.config file of the RountingServiceApp, whichredirect all incoming messages to the CalculatorService.
  • Create a Client Application
  • a) create a proxy class (Add Service Reference to the Calculator Service)
  • b) create a client Endpointwith
  • (A)ddress: routing service (http://localhost:8000/routingservice/router )
  • (B)inding: routing service
  • (C)ontract: calculatorcontract
  • The client does not know anything about the CalculatorService besides the contract of course !!!!
workflow foundation 4 0
Workflow Foundation 4.0
  • XAML-only workflows are the new default
    • Unified model between WF, WCF, and WPF
  • Extended base activity library
    • More activities will be present on CodePlex
  • WF 4.0 simplifies data flow by adding:
    • Arguments, variables, and expressions
    • Significant improvements in performance and scalability
    • New FlowChart Workflow
  • Improved WF 4.0 designer / Designer Rehosting
wcf and wf
WCF and WF
  • There is great potential in WF + WCF
    • .NET 3.0 didn\'t provide any integration
    • .NET 3.5 added initial WCF support
    • .NET 4.0 is investing heavily in this area

 Workflow Services !!!

  • Think "WCF on the outside, WF on the inside"
    • WCF exposes external interface
    • WF describes internal flow & state transitions
wf scenario

WF Scenario

CLIENT

SERVER

wf 3 0 in net 4 3 scenarios
WF 3.0 in .NET 4  3 Scenarios
  • Stick with WF3.x workflow model
  • Interop: Use WF3.x artifacts in WF4 solutions
  • Rewrite WF3.x activities and workflows

Migration guidance for WF Developers

dublin after net 4
Dublin (after .NET 4)
  • IIS 7/WAS is today’s hosting environment for WCF service and WF workflows (WorkflowServiceHost class)
  • Provides valuable hosting and management features for your WCF and WF applications
  • Part of the Windows Server Application Server role
  • Extensions built on top of IIS 7 with tracing, monitoring and diagnostic capabilities
additional resources
Microsoft ConfidentialAdditional Resources
  • MSDN Developer Centers – .NET 3.5http://msdn.microsoft.com/wcfhttp://msdn.microsoft.com/wf
  • MSDN Developer Centers – .NET 4.0http://msdn.microsoft.com/wcf/future/http://msdn.microsoft.com/wf/future/
  • WF/WCF Team Bloghttp://blogs.msdn.com/endpoint/
  • Dublin

http://www.microsoft.com/net/dublin.aspx

the evolution of c
The Evolution of C#

C# 3.0

Language Integrated Query

C# 2.0

Generics

C# 1.0

Managed Code

the evolution of c1
The Evolution of C#

C# 4.0

Dynamic Programming

C# 3.0

Language Integrated Query

C# 2.0

Generics

C# 1.0

Managed Code

c 4 0 language innovations
C# 4.0 Language Innovations
  • Dynamically Typed Objects
  • Optional and Named Parameters
  • Improved COM Interoperability
  • Co- and Contra-variance
net dynamic programming1
.NET Dynamic Programming

IronPython

IronRuby

C#

VB.NET

Others…

Dynamic Language Runtime

Expression Trees

Dynamic Dispatch

Call Site Caching

ObjectBinder

JavaScriptBinder

PythonBinder

RubyBinder

COMBinder

dynamically typed objects
Dynamically Typed Objects

Calculator calc = GetCalculator();

int sum = calc.Add(10, 20);

object calc = GetCalculator();

TypecalcType = calc.GetType();

object res = calcType.InvokeMember("Add",

BindingFlags.InvokeMethod, null,

newobject[] { 10, 20 });

int sum = Convert.ToInt32(res);

ScriptObject calc = GetCalculator();

object res = calc.Invoke("Add", 10, 20);

int sum = Convert.ToInt32(res);

Statically typed to be dynamic

dynamic calc = GetCalculator();

int sum = calc.Add(10, 20);

Dynamic conversion

Dynamic method invocation

dynamically typed objects1
Dynamically Typed Objects

Compile-time typedynamic

Run-time typeSystem.Int32

dynamic x = 1;

dynamic y = "Hello";

dynamic z = newList<int> { 1, 2, 3 };

  • When operand(s) are dynamic…
  • Member selection deferred to run-time
  • At run-time, actual type(s) substituted for dynamic
  • Static result type of operation is dynamic
dynamically typed objects2
Dynamically Typed Objects

public static class Math

{

publicstaticdecimal Abs(decimal value);

publicstaticdouble Abs(double value);

publicstaticfloat Abs(float value);

publicstaticint Abs(int value);

publicstaticlong Abs(long value);

publicstaticsbyte Abs(sbyte value);

publicstaticshort Abs(short value);

...

}

Method chosen at compile-time:double Abs(double x)

double x = 1.75;

double y = Math.Abs(x);

Method chosen at run-time: double Abs(double x)

dynamic x = 1.75;

dynamic y = Math.Abs(x);

Method chosen at run-time:int Abs(int x)

dynamic x = 2;

dynamic y = Math.Abs(x);

idynamicobject
IDynamicObject

publicabstractclassDynamicObject : IDynamicObject

{

publicvirtualobjectGetMember(GetMemberBinder info);

publicvirtualobjectSetMember(SetMemberBinder info, object value);

publicvirtualobjectDeleteMember(DeleteMemberBinder info);

publicvirtualobjectUnaryOperation(UnaryOperationBinder info);

publicvirtualobjectBinaryOperation(BinaryOperationBinder info, objectarg);

publicvirtualobject Convert(ConvertBinder info);

publicvirtualobject Invoke(InvokeBinder info, object[] args);

publicvirtualobjectInvokeMember(InvokeMemberBinder info, object[] args);

publicvirtualobjectCreateInstance(CreateInstanceBinder info, object[] args);

publicvirtualobjectGetIndex(GetIndexBinder info, object[] indices);

publicvirtualobjectSetIndex(SetIndexBinder info, object[] indices, object value);

publicvirtualobjectDeleteIndex(DeleteIndexBinder info, object[] indices);

publicMetaObjectIDynamicObject.GetMetaObject();

}

optional and named parameters
Optional and Named Parameters

Primary method

publicStreamReaderOpenTextFile(

string path,

Encodingencoding,

booldetectEncoding,

intbufferSize);

Secondary overloads

publicStreamReaderOpenTextFile(

string path,

Encodingencoding,

booldetectEncoding);

publicStreamReaderOpenTextFile(

string path,

Encodingencoding);

publicStreamReaderOpenTextFile(

string path);

Call primary with default values

optional and named parameters1
Optional and Named Parameters

publicStreamReaderOpenTextFile(

string path,

Encodingencoding = null,

booldetectEncoding = true,

intbufferSize = 1024);

Optional parameters

Named argument

OpenTextFile("foo.txt", Encoding.UTF8);

OpenTextFile("foo.txt", Encoding.UTF8, bufferSize: 4096);

Named arguments can appear in any order

Arguments evaluated in order written

Named arguments must be last

OpenTextFile(

bufferSize: 4096,

path: "foo.txt",

detectEncoding: false);

Non-optional must be specified

improved com interoperability
Improved COM Interoperability

objectfileName = "Test.docx";

object missing = System.Reflection.Missing.Value;

doc.SaveAs(reffileName,

ref missing, ref missing, ref missing,

ref missing, ref missing, ref missing,

ref missing, ref missing, ref missing,

ref missing, ref missing, ref missing,

ref missing, ref missing, ref missing);

doc.SaveAs("Test.docx");

improved com interoperability1
Improved COM Interoperability
  • object  dynamic mapping

… you can now say

excel.Cells[1, 1].Value = "Hello";

instead of

((Excel.Range)excel.Cells[1, 1]).Value2 = "Hello";

… and

Excel.Range range = excel.Cells[1, 1];

instead of

Excel.Range range = (Excel.Range)excel.Cells[1, 1];

co and contra variance
Co- and Contra-variance

.NET arrays are co-variant

string[] strings = GetStringArray();

Process(strings);

…but not safelyco-variant

void Process(object[] objects) {

objects[0] = "Hello"; // Ok

objects[1] = newButton(); // Exception!

}

void Process(object[] objects) { … }

Until now, C# generics have been invariant

List<string> strings = GetStringList();

Process(strings);

C# 4.0 supports safe co- and contra-variance

void Process(IEnumerable<object> objects) {

// IEnumerable<T> is read-only and

// therefore safely co-variant

}

void Process(IEnumerable<object> objects) { … }

safe co and contra variance
Safe Co- and Contra-variance

publicinterfaceIEnumerable<T>

{

IEnumerator<T> GetEnumerator();

}

publicinterfaceIEnumerable<out T>

{

IEnumerator<T> GetEnumerator();

}

out= Co-variantOutput positions only

Can be treated asless derived

publicinterfaceIEnumerator<out T>

{

T Current { get; }

boolMoveNext();

}

publicinterfaceIEnumerator<T>

{

T Current { get; }

boolMoveNext();

}

IEnumerable<string> strings = GetStrings();

IEnumerable<object> objects = strings;

in= Contra-variantInput positions only

publicinterfaceIComparer<T>

{

int Compare(T x, T y);

}

publicinterfaceIComparer<in T>

{

int Compare(T x, T y);

}

Can be treated asmore derived

IComparer<object> objComp = GetComparer();

IComparer<string> strComp = objComp;

variance in c 4 0
Variance in C# 4.0
  • Supported for interface and delegate types
  • Value types are always invariant
    • IEnumerable<int> is notIEnumerable<object>
variance in net framework 4 0
Variance in .NET Framework 4.0

Interfaces

System.Collections.Generic.IEnumerable<out T>

System.Collections.Generic.IEnumerator<out T>

System.Linq.IQueryable<out T>

System.Collections.Generic.IComparer<in T>

System.Collections.Generic.IEqualityComparer<in T>

System.IComparable<in T>

Delegates

System.Func<in T, …, out R>

System.Action<in T, …>

System.Predicate<in T>

System.Comparison<in T>

System.EventHandler<in T>

the evolution of c2
The Evolution of C#

C# 4.0

Dynamic Programming

C# 3.0

Language Integrated Query

C# 2.0

Generics

C# 1.0

Managed Code

additional resources1
Additional Resources
  • C# 4.0 Samples and Whitepaper
    • http://code.msdn.microsoft.com/csharpfuture
  • Visual C# Developer Center
    • http://csharp.net
  • C# team member’s blogs
    • http://blogs.msdn.com/ericlippert/
    • http://blogs.msdn.com/cburrows/
    • http://blogs.msdn.com/samng/
    • http://blogs.msdn.com/sreekarc/
    • http://blogs.msdn.com/mattwar/
    • http://blogs.msdn.com/ed_maurer/
    • http://blogs.msdn.com/davsterl/
    • http://blogs.msdn.com/alexghi
ado net entity framework
ADO.NET Entity Framework

Entity Data Model

  • Entity Data Model
    • Define your application model
      • Map it to a persistence store
    • Comprised of 3 layers (XML files):
      • Conceptual (CSDL)
      • Mapping (MSL)
      • Storage (SSDL)
    • Databaseagnostic
      • Databasevendors are developing providers …
        • http://msdn.microsoft.com/en-us/data/dd363565.aspx
    • Twoquery options:
      • Entity SQL
      • LINQ To Entities

Conceptual

Mapping

Storage

linq to entities
LINQ TO ENTITIES

Application

from c in db.Customers

where c.City == "London"

select c.CompanyName

db.Customers.Add(c1);

c2.City = "Barcelona";

db.Customers.Remove(c3);

LINQ Query

Objects

SaveChanges()

Entity Data Model

SQL Query

Rows

DML or SProcs

SELECT CompanyName

FROM Cust

WHERE City = \'London\'

INSERT INTO Cust …

UPDATE Cust …DELETE FROM Cust …

DB (for instance SQL Server)

lazy loading in ef v1
Lazy Loading in EF v1

varcustomers = fromcustindb.Customers where cust.City == “London"select cust;

foreach (Customercust in customers)

{// avoidsunnecessaryqueries

if (!cust.Orders.IsLoaded){cust.Orders.Load();} 

foreach (Orderorder in cust.Orders){ // do somethingwithdetail}

}

lazy loading in ef v2
Lazy Loading in EF v2

varcustomers = fromcustindb.Customers where cust.City == “London"select cust;

db.ContextOptions.DeferredLoadingEnabled = true;

foreach (Customercust in customers)

{foreach (Orderorder in cust.Orders){ // do somethingwithdetail}

}

entity framework v2
Entity Framework v2
  • Automatic Lazy Loading, Pluralization
  • Foreign Key Support
  • Persistent Ignorance (POCO)
    • POCO Experience in EF v2 – Part 1
    • POCO Experience in EF v2 – Part 2

… More to come on http://blogs.msdn.com/adonet/

  • N-tier Support
    • Self-Tracking Entities (Smart entity objects which track their own changes & changes to related entities)
self tracking entities in ef v2 mid tier
Self-tracking Entities in EF v2 (mid-tier)

interface ICustomerService

{

Customer GetCustomer(string customerID);

voidUpdateCustomer(Customer customer);

}

self tracking entities in ef v2 mid tier1
Self-tracking Entities in EF v2 (mid-tier)

public Customer GetCustomer(string customerID)

{

using (NorthwindEntitiescontext=new NorthwindEntities())

{

var result = context.Customers.

Include("Orders.OrderDetails").

Single(c => c.CustomerID == customerID);

return result;

}

}

public voidUpdateCustomer(Customer customer)

{

using (NorthwindEntitiescontext=new NorthwindEntities())

{

context.Customers.ApplyChanges(customer);

context.SaveChanges();

}

}

self tracking entities in ef v2 client
Self-tracking Entities in EF v2 (client)

public voidDeleteObjectsTexts()

{

using(CustomerServiceClientclient=new CustomerServiceClient())

{

var customer= client.GetCustomer("ALFKI");

customer.Orders.First().Delete();

client.UpdateCustomer(customer);

}

}

The resultingentity graph is sent back to the service tierusing the UpdateCustomermethod!!!

entity framework v21
Entity Framework v2
  • Code Generation(T4 templates support)
    • Completely replace entity framework code generation with custom code
    • Generate POCO classes from the model to use as a starting point in my applications
    • Generate self-tracking entity classes
entity framework v22
Entity Framework v2
  • Code GenerationT4 templates support, but No Editor Support
    • 3rd party solutions which provides T4 Editors:
      • http://www.visualt4.com
      • http://www.tangible.de/modellingtools_teaser.aspx (Tangible T4 Editor now listed in Visual Studio 2010 Beta 1 Extension Manager)
entity framework v23
Entity Framework v2
  • Model Defined Functions
  • Model First Development
  • Complex Types

varresults = from person indb.People where GetAge(person) > 35select person;

GetAge must be defined within the CSDL File (Sample)

resources ef
Resources (EF)
  • MSDN Documentation
    • What’s New in ADO.NET
  • ADO.NET Blog
    • http://blogs.msdn.com/adonet
  • EF Design Blog
    • http://blogs.msdn.com/efdesign
  • Data Developer Center
    • http://msdn.microsoft.com/data
  • Entity Framework HOL
    • http://blogs.msdn.com/swiss_dpe_team/archive/2008/10/27/ado-net-entity-framework-hands-on-lab.aspx
msdn ressources
MSDN Ressources

PresentationsMSDN Events PresentationfinderMSDN Webcasts

Upcoming EventsTechEd Europe 2009, 9 – 13 November in Berlin

MSDN FlashSign up (bi-weekly newsletter)

MSDN Team BlogRSS: http://blogs.msdn.com/swiss_dpe_team/Default.aspx

Developer User Groups & CommunitiesMobile DevicesMicrosoft Solutions User Group Switzerland.NET Managed User Group of SwitzerlandFoxPro User Group Switzerland

ad