Præsentation er lastning. Vent venligst

Præsentation er lastning. Vent venligst

Henrik Westergaard Hansen ISV Developer Evangelist Microsoft

Lignende præsentationer


Præsentationer af emnet: "Henrik Westergaard Hansen ISV Developer Evangelist Microsoft"— Præsentationens transcript:

1 Henrik Westergaard Hansen ISV Developer Evangelist Microsoft henrikwh@microsoft.com http://blogs.msdn.com/henrikwh

2 Nye sprog konstruktioner i C# 3.0 Automatic properties Object & Collection initializers Type inferens og var keywordet Anonyme typer Lambda expressions Extension methods LINQ to Objects SQL XML

3 Nemmere måde at skrive default properties på Signaturen ændres ikke hvis du senere modificerer en setter eller getter

4 Initialiser public properties og fields i en linje Objekter tilføjes collections i collection- initialiseringen Kan kombineres med constructors

5 Type kan udledes inden for samme scope Statisk typet Var keywordet bruges Fuld intellisense

6 En type behøver ikke have et navn Oversættes internt til en klasse Object initializer syntaks

7 I C# 3.0 er Lambdaudtryk anonyme metoder (C# 2.0) i forklædninger En mere præcis/koncis måde at skrive anonyme metoder på Anonyme metoder En delegate der peger på en metode. Metoden har bare ikke noget navn

8 ”En måde, at lave statiske instansmetoder” Er det pænt? Det bryder med OO tankegangen Er det anvendeligt? Helt bestemt. Specielt nå man laver frameworks LINQ bruger extension metods på IEnumerable for at gøre collections queryable. Implict typed arrays Type inferens (a er en int) Lambdaudtryk Implict typed arrays Type inferens (a er en int) Lambdaudtryk

9 Impedance mismatch Forskellige type systemer Objekter vs tupler Arv og polymorfi findes ikke som begreber i databaser Normalisering ignoreres oftest i OO design Objekter kræver ikke en nøgle etc http://en.wikipedia.org/wiki/Object-Relational_impedance_mismatch

10 C# 3.0C# 3.0 Visual Basic 9.0Visual Basic 9.0 OthersOthers.NET Language Integrated Query LINQ to Objects LINQ to DataSets LINQ to SQL LINQ to Entities LINQ to XML Objects XML Relational

11 Forspørgsler kan nu laves direkte fra.NET med query expressions (som bare er sukker over lambdaudtryk) Query operatorer kan bruges mod alle collections operatorer: Select, Where, GroupBy, Join, etc. Kan udvides eller skiftes ud Fordele Arbejd med data på en konsistent måde udanset datatype Interager med data som var det objekter Integration med programmeringssproget IntelliSense i Visual Studio Var query = from c in LoadCustomers() where c.City.StartsWith(“M”) group c by c.City into g select new Result(City = g.key, Count = g.Count());

12 LINQ til SQL er en ORM Hver klasse mapper til et SQL skema objekt Tabel, View Stored procedure, Table valued function Simpel omdøbning af tabeller og kolonner Fremmednøgler implementerer relationer Partielle klasser bruges. Desuden partielle metoder Optimeringer Loading Options "Span" related information ObjectTrackingEnabled DeferredLoadingEnabled Compiled Query Save overhead of SQL generation from Language Expression

13 Nyt XML api Kan nestes vilkårligt

14 henrikwh@microsoft.com http://blogs.msdn.com/henrikwh

15 MSDN Developer Center http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx LINQ Forum http://forums.microsoft.com/msdn/showforum.aspx?forumid=123 Channel9 Linq Videos http://channel9.msdn.com/tags/linq Blogs Scott Guthrie http://weblogs.asp.net/scottgu/archive/2007/04/21/new-orcas-language-feature-query- syntax.aspx Charlie Calvert http://blogs.msdn.com/charlie/archive/2006/10/05/Links-to-LINQ.aspx Luke Hoban: http://blogs.msdn.com/luke Mads Torgersen http://msdn.blogs.com/madst Community sites http://www.linqdev.com/publicportal/ http://linqinaction.net/ LINQ Samples 101 samples http://msdn2.microsoft.com/en-us/vcsharp/aa336746.aspx Orcas Beta 1 samples http://msdn2.microsoft.com/en-us/bb330936.aspx

16 © 2007 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.

17

18 Design Points Flexible Mapping to Existing Relational Schema Well defined Conceptual model Share common model across products (Reporting, Analysis, etc…) Declarative Mapping between Application and Store Allows Storage Schema and Application to evolve independently Explicit Operations Server interactions should be explicit Build implicit logic on top of explicit operations Common Textual "EntitySQL" Language for Ad-Hoc queries Targets: Microsoft SQL Server and third-party databases RTM: Microsoft Visual Studio 2008 Update H1CY08

19 Flexible Mapping Mapping a single class to multiple tables/views Mapping to different types of inheritance Single Table per Class Hierarchy Separate Table for each Class in a Hierarchy Shared Table for Base Class members in a Hierarchy Complex (composite) types i.e., Street, City, Region, and Zip as "Address" Directly mapping Many:Many relationships Mapping to an arbitrary Query Store Query Expose arbitrary store query as a storage Table Entity Query Express mapping as EntitySQL against storage schema


Download ppt "Henrik Westergaard Hansen ISV Developer Evangelist Microsoft"

Lignende præsentationer


Annoncer fra Google