.NET Training

1,916 views

Published on

http://www.Intertech.com

This is a slide deck from a .NET overview presentation delivered at Microsoft.

Published in: Technology, Education
2 Comments
4 Likes
Statistics
Notes
  • Hi All, We are planning to start new Salesforce Online batch on this week... If any one interested to attend the demo please register in our website... For this batch we are also provide everyday recorded sessions with Materials. For more information feel free to contact us : siva@keylabstraining.com. For Course Content and Recorded Demo Click Here: http://www.keylabstraining.com/salesforce-online-training-hyderabad-bangalore
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • IT Pathshala, Noida-Sector-63, offers Guaranteed JOB with .NET Training Programs.

    PAY US ONLY IF YOU GET A JOB!

    CALL US - +91-9871350999 or +91-8800394970

    Technology Centre Address: H-110, Sector-63, Noida (UP)

    Program Takeaways:

    - GUARANTEED JOB in your technology domain
    - Live Major Project development
    - Experience Letter on Training Completion
    - Certification on Training Completion
    - Project Source Code available in CD

    Program Highlights:

    - 100% Guaranteed Job – Don’t pay us if you don’t get a JOB!
    - Industry Ready Courses
    - LIVE International Project Experience
    - Exposure to corporate culture at our IT services facility
    - Networking & Interaction with Industry Experts
    - Training Provided by a reputed IT Company
    - Live Project Source Code made available in CD
    - Technology certification and experience letter at program completion
    - Online Study Content

    CALL US - +91-9871350999 or +91-8800394970

    Our website: www.itpathshala.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
1,916
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
0
Comments
2
Likes
4
Embeds 0
No embeds

No notes for slide

.NET Training

  1. 1. Introduction to .NET 3.0, C# 3.0 and LINQ Andrew Troelsen MCP, MCT, C# MVP An Intertech Course Copyright © Intertech, Inc. 2006. All Rights Reserved.
  2. 2. Introduction to .NET 3.0, C# 3.0 and LINQ Objectives • Understand the scope of .NET 3.0 • Introduce Windows Presentation Foundation (WPF) • Introduce Windows Communication Foundation (WCF) • Introduce Windows Workflow Foundation (WF) • Examine proposed C# 3.0 Language Changes • Preview LINQ / LINQ to Sql / LINQ to XML Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 2
  3. 3. Introduction to .NET 3.0, C# 3.0 and LINQ The Scope of .NET 3.0 • .NET 3.0 is an augmentative release of the .NET base class libraries: • Everything you currently know about .NET 1.0 / 1.1 / 2.0 still applies 100%. • For example, Windows Forms / .NET Remoting are not depreciated. • .NET 3.0 is not only for Vista development: • Windows XP and Windows Server 2003 can be used to develop and execute .NET 3.0 software with no problems. • However, .NET 3.0 software can perform ‘better’ on Vista given the new driver model (etc.). • .NET 3.0 is natively part of Vista. • XP / Windows Server requires installation of the .NET 3.0 SDK / .NET 3.0 runtime. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 3
  4. 4. Introduction to .NET 3.0, C# 3.0 and LINQ The Scope of .NET 3.0 • While .NET 3.0 is officially released, the development tools are in beta! • Microsoft has beta plug ins which allow you to build .NET 3.0 applications (Wizards, designers, project templates, etc). • However, their current functionality (in some cases) is quite limited. • www.msdn.microsoft.com/windowsvista/downloads The .NET 3.0 SDK can Also be found here, for WinXP and Windows Server Machines. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 4
  5. 5. Introduction to .NET 3.0, C# 3.0 and LINQ The Scope of .NET 3.0 • Currently, C# 3.0 / LINQ are in beta. • Thus, when you build .NET 3.0 software, you are doing so with the C# 2.0 compiler! • C# 3.0 (and VB 9.0) / LINQ are not set to be released until Spring 2007. • However, you can download the CTPs for LINQ get ahead of the curve. • The LINQ CTP includes: • C# 3.0, VB 9.0 compilers. • LINQ assemblies. • Numerous white papers / code samples. • www.msdn.microsoft.com/data/ref/linq Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 5
  6. 6. Introduction to .NET 3.0, C# 3.0 and LINQ The Scope of .NET 3.0 • .NET 3.0 is represented by three core technologies: • Windows Presentation Foundation (WPF) • Windows Communication Foundation (WCF) • Windows Workflow Foundation (WF) • First up, WPF… Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 6
  7. 7. Introduction to .NET 3.0, C# 3.0 and LINQ WPF • The Windows Forms API is a well know model for building desktop apps with the .NET platform. • However, building a ‘real world’ WinForms application demands mastering several diverse and asymmetrical APIs. Application Requirement .NET 2.0 Solution Core Form / Control model Windows Forms 2D Graphics GDI+ (System.Drawing.dll) 3D Graphics DirectX APIs Live Video Feeds Windows Media Player APIs Fixed Style Documents Programmatic manipulation of PDF files. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 7
  8. 8. Introduction to .NET 3.0, C# 3.0 and LINQ WPF • One of the major goals with WPF is to provide a single, symmetrical model for desktop development. • With WPF, all necessary technologies are baked into the same assemblies (much easer!). Application Requirement .NET 3.0 Solution Core Form / Control model Windows Presentation Foundation 2D Graphics Windows Presentation Foundation 3D Graphics Windows Presentation Foundation Live Video Feeds Windows Presentation Foundation Fixed Style Documents (PDFs) Windows Presentation Foundation Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 8
  9. 9. Introduction to .NET 3.0, C# 3.0 and LINQ WPF • Another major difference between WinForms and WPF is support for a separation of concerns via XAML. • XAML is essentially, desktop markup. • WPF apps allow you to separate the look and feel of your apps from the logic which drives it. • Use of XAML however, is entirely optional. • If you wish, you can take the 100% pure code approach. • You could take a 100% pure XAML approach. • Or (most commonly) take a code file approach (XAML / Code split). • When taking the code file approach, you will find the process of building a WPF app is eerily similar to building an ASP.NET web app. • Partial classes, markup + code, XAML to code mappings, etc. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 9
  10. 10. Introduction to .NET 3.0, C# 3.0 and LINQ WPF • The major motivation for XAML is the separation of concerns. • Programmers can use dev tools (VS 2005) to do the fun stuff (write .NET code). • Graphical minded individuals can using design tools (Expression Interactive Designer) to build a rich UI interface. • The XAML files can then be passed to us and integrated into our projects. • Finally! A way for programmers and designers to live in peace! • More information on MS Expression products: • www.microsoft.com/products/expression Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 10
  11. 11. Introduction to .NET 3.0, C# 3.0 and LINQ WPF • In addition to the benefits already mentioned, WPF offers a number of additional bells and whistles: • The ability to host a WPF application within a web browser (via XAML browser applications…XBAP). • Numerous layout managers to position controls. • A new (very slick) data binding engine. • Support for styles and templates, to ‘skin’ your WPF apps. • WPF relies entirely on vector graphics, allowing an image to be automatically resized to fit the size and resolution of the screen it's displayed on. • Integrated animation / 3D-rendering services. • Support for interop-ing with legacy UI models (Windows Forms, ActiveX, etc). Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 11
  12. 12. Introduction to .NET 3.0, C# 3.0 and LINQ WPF • Demo! A 100% Pure Code WPF Application. • Authored via notepad++ / csc.exe. • Composed on a single window, button widget. • Compiled via *.rsp files • Demo! A 100% XAML Application. • Same app, two *.xaml files. • Event handling wrapped in <CDATA>. • Compiled via msbuild / *csproj. • Demo! Code-file Application. • Xaml + Code files. • Use of partial classes • Created w/ VS 2005 “Orcas“ • BAML investigated! Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 12
  13. 13. Introduction to .NET 3.0, C# 3.0 and LINQ WCF • Windows Communication Foundation (WCF) integrates numerous distributed technologies. • Similar to WPF, WCF lives to provide symmetry. • Today building a distributed app is complex at best. • Too many diverse APIs (COM+, MSMQ, web services, remoting). • Each has a different object model, configuration tools, documentation, etc. • The current approach is complex, confusing and hard to maintain. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 13
  14. 14. Introduction to .NET 3.0, C# 3.0 and LINQ WCF • WCF provides a single, extendable object model. • Using *.config files, you can radically change the underlying plumbing via markup (channels, transports, etc). • SvcConfigEditor.exe can build client-side and server-side *.config files. This WCF *.config file is part of the .NET 3.0 SDK. Future versions of VS 2005 Will no-doubt provide similar Functionality. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 14
  15. 15. Introduction to .NET 3.0, C# 3.0 and LINQ WCF • Support for strongly typed as well as untyped messages. • This approach allows .NET applications to share custom types simply and efficiently. • Software created using other platforms (such as Java) can consume streams of loosely typed XML. • Support for several endpoints to allow you to choose the most appropriate plumbing to transport data to and fro. • HTTP, HTTP + SOAP • MSMQ • Named Pipes • TCP • COM+ • Any custom endpoint you might dream up… Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 15
  16. 16. Introduction to .NET 3.0, C# 3.0 and LINQ WCF • WCF applications are designed by specifying the A, B, Cs: • Address: Where does this service life? • Bindings: Which protocols are used to access it? • Contracts: Once I get there, what will I find? • The Service Configuration Tool can be used to specify the set of bindings and address of a given service. • The contract of a WCF service are defined in code. • In many ways, these A, B, Cs are a re-telling of WSDL descriptors. • In other ways, these A, B, Cs are a re-telling to the sort of data found within a .NET remoting configuration file. • The short answer is, if you have worked with XML web services or .NET remoting… • …you’ll feel right at home with WCF. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 16
  17. 17. Introduction to .NET 3.0, C# 3.0 and LINQ WCF • Building a WCF service is very simple: • Numerous attributes can be used to control service behaviors. • Functionality is (typically) exposed using strongly typed interfaces. • The collection of WCF types is typically bundled into a .NET *.dll. [ServiceContract] public interface ICarOrder { // Allows caller to place and order and obtain // an order ID. [OperationContract] int PlaceOrder(string make, string color, double price); // Allows caller to get current status of the order. [OperationContract] string CheckOrderStatus(int orderID); } Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 17
  18. 18. Introduction to .NET 3.0, C# 3.0 and LINQ WCF • WCF Services can be hosted from a variety of locations. • Any *.exe assembly. • Within IIS • From WAS (Vista-specific activation service). • The ServiceHost type is used (directly or indirectly) to host the service itself. • Anything can be a consumer of WCF services: • *.exe, *.dll, web page, WCF service, etc. • .NET, COM, Java, C++, etc. • Linux, Mac, XP, Vista, etc. • Simply adjust the bindings to ensure the correct ‘reach’. • Client side proxies can be generated with svcutil.exe or VS 2005. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 18
  19. 19. Introduction to .NET 3.0, C# 3.0 and LINQ WCF • WCF Demo! • A WCF service assembly, build with interface based programming techniques. • A console based WCF host (with related *.config file). • A console based WCF client (with related *.config file). • Remember! Both *.config files can be visual created using the Service Configuration Tool. • Furthermore, the proxy can be automatically generated using svcutil.exe / VS 2005. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 19
  20. 20. Introduction to .NET 3.0, C# 3.0 and LINQ WF • Windows Workflow Foundation (WF) is perhaps the 'strangest' element of .NET 3.0. • Earlier versions of .NET have no direct equivalent. • However, the idea of ‘workflow enabled applications’ is not new. • Using WF, you are able to model directly in your assembly the workflows used by your applications. • Workflows = business processes. • The WF runtime engine can then execute these tasks as your application is running. • The same model used to author code can be shared with other non- technical staff. • Thus, no need to maintain separate docs to illustrate to others what your code is doing. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 20
  21. 21. Introduction to .NET 3.0, C# 3.0 and LINQ WF • WF enabled applications consist of any number of ‘activities’. • These activities are connected via decision / iteration paths. • Paths can run in parallel. • WFs can be sequential or state machine. • Each activity maps to real types in real namespaces. • Thus, you can interact with your activities directly, or simply allow the WF runtime to process them as required. • Visual Studio 2005 “Orcas” supports numerous designers with allow you to model your business process. • *.Designer.* files are updated automatically. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 21
  22. 22. Introduction to .NET 3.0, C# 3.0 and LINQ WF • WF Demo! • Illustrate the WF designer tools. • Examine baked in activities. • Simple WF example. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 22
  23. 23. Introduction to .NET 3.0, C# 3.0 and LINQ C# 3.0 Language Features • Recall that C# 3.0 / VB 9.0 supports numerous features which make it possible to interact with the LINQ technology set. • Also recall that these updates (and LINQ) are currently in beta, and are not to be released formally until Spring 2007 (or so). • Here, we will survey some (but not all) of the proposed changes. • Due to time constraints, an overview of the lambda operator (=>) will not be covered. • In a nutshell, lambda expressions are a grand simplification for working with delegate types. • Lambdas not currently supported in VB 9.0! Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 23
  24. 24. Introduction to .NET 3.0, C# 3.0 and LINQ C# 3.0 Language Features • Many features can be used directly ‘as-is’ with little concern for LINQ or lambda expressions (a hallmark of functional languages). • However, as mentioned, when using LINQ, many of these new language constructs make much more sense. • Before we examine LINQ, here is a quick overview of the core C# language features. • VB 9.0 has very similar syntax for most of these features. • VB-minded developers can consult the LINQ documentation for specifics. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 24
  25. 25. Introduction to .NET 3.0, C# 3.0 and LINQ C# 3.0 Language Features • Implicitly typed local variables using ‘var’. • Compiler infers the underlying data type, based on assignment. • NOT a Variant! NOT script code! Strongly typed! • Greatly simplifies working with LINQ query expressions. static void Main() { // Implicitly typed local variables. var myInt = 0; var myBool = true; var myString = quot;Time, marches on...quot;; // Print out the underlying type. Console.WriteLine(quot;myInt is a: {0}quot;, myInt.GetType().Name); Console.WriteLine(quot;myBool is a: {0}quot;, myBool.GetType().Name); Console.WriteLine(quot;myString is a: {0}quot;, myString.GetType().Name); } Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 25
  26. 26. Introduction to .NET 3.0, C# 3.0 and LINQ C# 3.0 Language Features • Extension methods allow you to add new functionality to a pre-compiled type. • Allows for easy augmentation of types for which you do not have source code. • Again, very helpful for LINQ. • First parameter of a method can now be marked with quot;this <dataType>quot; to control which type is being extended. • Other namespaces can import the definition of the defining namespace. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 26
  27. 27. Introduction to .NET 3.0, C# 3.0 and LINQ static class MyExtensions { // This method allows any object to display the assembly This extension method applies // it is defined in. public static void DisplayDefiningAssembly(this object obj) To everything (System.Object). { Console.WriteLine(quot;{0} lives here:nt->{1}nquot;, obj.GetType().Name, Assembly.GetAssembly(obj.GetType())); } // This method allows any integer to reverse its digits. // for example, 56 would return 65. This extension method only public static int ReverseDigits(this int i) { Applies to integers. // Translate int into a string, and then // get all the characters. char[] digits = i.ToString().ToCharArray(); // Now reverse items in the array. Array.Reverse(digits); // Put back into string. string newDigits = new string(digits); // Finally, return the modified string back as an int. return int.Parse(newDigits); } } Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 27
  28. 28. Introduction to .NET 3.0, C# 3.0 and LINQ static void Main(string[] args) { // Old types, new identity! int myInt = 12345678; myInt.DisplayDefiningAssembly(); System.Data.DataSet d = new System.Data.DataSet(); d.DisplayDefiningAssembly(); System.Media.SoundPlayer sp = new System.Media.SoundPlayer(); sp.DisplayDefiningAssembly(); // Use new integer functionality. Console.WriteLine(quot;Value of myInt: {0}quot;, myInt); Console.WriteLine(quot;Reversed digits of myInt: {0}quot;, myInt.ReverseDigits()); } Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 28
  29. 29. Introduction to .NET 3.0, C# 3.0 and LINQ C# 3.0 Language Features • Object initialization syntax allows you to set property values (or public field values) at the time of creation. • Can also call custom constructors. • Massive time saver. • Assume a Rectangle class which defines two properties (TopLeft, BottomRight) that each get / set a Point type. • The Point type has two properties (X, Y). • Thus, Rectangle ‘has’ two Points. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 29
  30. 30. Introduction to .NET 3.0, C# 3.0 and LINQ C# 3.0 Language Features • The ‘old school’ approach requires us to author numerous lines of code. • The ‘new school’ approach is much more compact… // Old school approach. Rectangle r = new Rectangle(); Point p1 = new Point(); // New school approach. p1.X = 10; Rectangle myRect = new Rectangle p1.Y = 10; { r.TopLeft = p1; TopLeft = new Point { X = 10, Y = 10 }, Point p2 = new Point(); BottomRight = new Point { X = 200, Y = 200} p2.X = 200; }; p2.Y = 200; r.BottomRight = p2; Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 30
  31. 31. Introduction to .NET 3.0, C# 3.0 and LINQ C# 3.0 Language Features • Anonymous types allow you to model the ‘shape’ of data without concern for it’s functionality. • Very helpful for LINQ queries. • Compiler generates a full blown class type in the background. • Anonymous types always: • Are constructed with the default constructor. • Extend System.Object (with value-based overrides). • Map name/value pairs into properties with backing fields. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 31
  32. 32. Introduction to .NET 3.0, C# 3.0 and LINQ // Make an anonymous object representing a car. var myCar = new {Color = quot;Bright Pinkquot;, Make = quot;Saabquot;, CurrentSpeed = 55}; [CompilerGenerated] public sealed class <Projection>f__0 { // You are given a default constructor. public <Projection>f__0(); // As well as a canned implementation of each virtual // member from System.Object public override bool Equals(object); public override int GetHashCode(); public override string ToString(); // As well, properties are used to wrap... public string Color { get; set; } public int CurrentSpeed { get; set; } public string Make { get; set; } // ... each private member variable. private string _Color; private int _CurrentSpeed; private string _Make; } Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 32
  33. 33. Introduction to .NET 3.0, C# 3.0 and LINQ LINQ • LINQ (Language Integrated Query) allows .NET languages to create strongly typed query expressions. • Full support for object representation. • Compiler checked, IntelliSense support, debugging support, etc. • LINQ queries are created using any number of ‘query operators’ or related method calls in the object model. • Modeled after SQL queries. • The twist is that a LINQ query expression can be executed against: • Relational databases. • XML documents • Any object implementing IEnumerable<T>. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 33
  34. 34. Introduction to .NET 3.0, C# 3.0 and LINQ LINQ • LINQ offers a unified solution to the problem of obtaining and manipulating ‘data’. • Under .NET 2.0, we were forced to learn unique APIs to gain access to various forms of data. • ADO.NET, XML namespaces, collection methods, etc. • Using LINQ, we can apply the same operators / statements to a wide variety of data stores. • Relational data, containers and XML docs. • Third parts can extend LINQ (via extension methods) to query over other data stores. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 34
  35. 35. Introduction to .NET 3.0, C# 3.0 and LINQ LINQ • Demo! LINQ over containers. • Examining query operators. • Building query expressions. • Check out the LINQ object model. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 35
  36. 36. Introduction to .NET 3.0, C# 3.0 and LINQ Wrap up! • This Oxygen Blast presentation only scratched the surface of WPF / WCF/ WF / LINQ / C# 3.0. • Want more? A 1-Day .NET 3.0 Intertech Boot Camp - Sponsored by Microsoft and Apress. - Content delivered by Apress authors. - Hands on lab time (your computer or ours). - March 29th, 2007. - www.DevBlitz.com Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 36
  37. 37. Introduction to .NET 3.0, C# 3.0 and LINQ Wrap up! • .NET 3.0 is an augmentative release to the .NET BCL. • WPF: Integrated desktop / Smart Client API. • WCF: Integrated communications API. • WF: Allows for integration of ‘workflow enabled applications’. • C# / VB 9.0 / LINQ are due out Spring 2007. • C# / VB 9.0 each support numerous language enhancements, most of which are their to support LINQ technologies. • LINQ provides a symmetrical manner in which to interact with ‘data’ in the broad sense of the term. Copyright © Intertech, Inc. 2006 • www.Intertech.com • 800-866-9884 • Slide 37

×