340 likes | 374 Views
Explore Visual Studio 2008 capabilities like multitargeting, occasionally connected systems, and more. Learn C# 3.0 language enhancements such as LINQ, extension methods, and lambda expressions.
E N D
Fons Sonnemans (Trainer) Reflection IT fons.sonnemans@reflectionit.nl http://www.reflectionit.nl Visual Studio 2008
Agenda • Multitargetting • Occasionally connected Systems • Office Applications • Client Applications • Windows Communication Foundation • ASP.NET Web Applications • C# 3.0 and LINQ
Release History Visual Studio 2008 Sp1 2008 .NET 3.5 Sp1 Visual Studio 2008 Visual Studio 2008 2007 2007 .NET 3.5 .NET 3.5 Visual Studio 2005 2006 .NET 3.0 .NET 3.0 Visual Studio .NET 2003 2005 .NET 2.0 .NET 2.0 Visual Studio .NET 2003 .NET 1.1 .NET 1.1 2002 .NET 1.0 .NET 1.0
Multitargetting No longer a hard link between Visual Studio and the application’s target framework .NET Fx 2.0 .NET Fx 3.0 .NET Fx 3.5 VS 2008
Sync Framework & Services Connected Single data source Database driven Hard coded Monolithic & rigid Occasionally connected Multiple data sources Information based Model driven SOA
ADO.NET Sync Services • No active connection to the database required • Data is persisted using SQL Server Everywhere Edition • Local Change Tracking for Sending Updates When Connected • VS2008 Developer Productivity • “Pay to Play”, RAD Component Architecture Leveraging Developers ADO.NET Knowledge • Auto Creation of Database and Table Schema Client App Sync Services SQL Server Everywhere Edition SQL Server
demo { ADO.NET Sync Services}
Ribbon Customization • New Look and Feel for Office UI • Replaces Command Bars in “the big 5” Office apps • VSTO Ribbon Designer Group Tab Control Ribbon
Custom Task & Actions Panes • VSTO simplifies and speeds up task pane UI design process with visual designers and .NET hookup • Actions Pane • More robust, easier to program alternative to Office’s built-in “Smart Document” technology • Custom Task Pane • The same general idea as Actions Pane, only on the application add-in level, not individual doc
Outlook Form Region Features • New technology in Outlook 2007 for enhancing and replacing Outlook’s built-in forms • Code behind form region is implemented as COM add-in • New controls provide built-in look & feel and data binding to Outlook data
demo { Office Applications}
demo { WPF Support in VS2008}
demo { WCF Support in VS2008, ASP.NET Applications}
Language Features in VS 2008 Most are LINQ enablers C# 3 VB9 Anonymous Types Collection Initialisers Extension Methods Automatic Properties XML Literals Lambda expressions If Ternary Operator Relaxed Delegates Lambda statements Object Initialisers Nullable Syntax Local Type Inference Partial Methods
C# 3.0: Local Variable Type Inference • Local variable type inference is a feature in C# 3.0 where you can use the var keyword instead of explicitly specifying the type of a variable. The C# 3.0 compiler makes the type of the variable match the type of the right side of the assignment. publicvoid Foo() { var i = 5; var s = "Hello"; var d = 1.0; var z; // compiler error, no initializer z = DateTime.Today; }
C# 3.0: Object Initializers publicclassPoint { privateint x, y; publicint X { get { return x; } set { x = value; } } publicint Y { get { return y; } set { y = value; } } } Field or property assignments Point a = newPoint { X = 0, Y = 1 }; Point a = newPoint(); a.X = 0; a.Y = 1;
C# 3.0: Anonymous Types var emp = new { Name = "Fons", Salary = 2000, DateTime.Today.Year }; var year = emp.Year; • Different anonymous object initializers that define properties with same names in the same order generate the same anonymous type classXXX { publicstring Name { get; set; } publicint Salary { get; set; } publicint Year { get; set; } }
C# 3.0: Extension Methods • Extend existing types with additional methods. namespace MyStuff { publicstaticclassUtil { publicstaticbool IsWeekend(thisDateTime value) { return (value.DayOfWeek == DayOfWeek.Sunday || value.DayOfWeek == DayOfWeek.Saturday); } } } Brings extensions into scope using MyStuff; dt.IsWeekend() MyStuff.Util.IsWeekend(dt) DateTime dt = DateTime.Today; bool b = dt.IsWeekend();
C# 3.0: Lambda Expressions delegatestringSomeDelegate(string s); C# 1.x privatestaticstring TestMethod1(string s) { return s.ToUpper(); } ... SomeDelegate d1 = newSomeDelegate(TestMethod1); string a = d1("abcde"); OO Function- Pointer C# 2.0 SomeDelegate d2 = TestMethod1; string a = d2("abcde"); Delegate Inference SomeDelegate d3 = delegate(string s) { return s.ToUpper(); }; string a = d3("abcde"); C# 2.0 Anonymous Method C# 3.0 SomeDelegate d4 = s => s.ToUpper(); string a = d4("abcde"); Lambda Expression
demo { C# 3.0}
Language INtegrated Query? Lots of code written today in order to loop, filter, sort, group, etc. Why not build better support for this? sort sum loop
Why Have LINQ? Access to common data like XML or SQL is harder than accessing in memory objects; Why not have better API’s than this? hope! pray! hope!
Language Integrated Query fromdatainsomeDataSource joinotherDatainsomeOtherSource onkeyExprequalskeyExpr(intoitemName)? letsomeVariable= someExpression wheresomePredicate orderby (expression(ascending | descending)?)* selectexpression groupexpressionbykeyExpression intoitemName Language Features ( C# V3 and VB V9 ) .NET Framework V3.5 Custom Objects XML SQL
How Does LINQ Work? • Compiler rewrites as method calls • No need to implement Select() etc. if myData is either IEnumerable IQueryable • Implementations already present in the .NET Framework for those cases
IEnumerable & IQueryable? • IEnumerable – query is executed in memory where select Execute Execute • IQueryable – query is parsed then translated to SQL and finally executed on to the database where select Parse & Execute
LINQ to SQL db.Customers.InsertOnSubmit(c1); c2.City = "Asten"; db.Customers.DeleteOnSubmit(c3); from c in db.Customers where c.City == "London" select c.CompanyName; Application IQueryable<T> Objects SubmitChanges() LINQ to SQL SQL Query or SProc Resultset DML or SProcs SQL Server SELECT CompanyName FROM Customer WHERE City = 'London' INSERT INTO Customer … UPDATE Customer …DELETE FROM Customer …
demo { LINQ to Objects, LINQ to SQL}
Summary • Visual Studio 2008 • Great for Windows Vista Development • Great for Client Development • Great for Web Development • Great for Database Applications Development • Great for .NET Framework v3.5 • Service Pack 1 will add even more features • ADO.NET Entity Framework • ADO.NET Data Services • ASP.NET Dynamic Data
Resources • http://msdn.microsoft.com/en-us/vstudio • http://msdn.microsoft.com/en-us/sync • http://msdn.microsoft.com/en-us/office • http://windowsclient.net • http://netfx3.com/content/WCFHome.aspx • http://www.asp.net • http://msdn.microsoft.com/en-us/vcsharp • http://www.datadeveloper.net • Visual Studio 2008 Upgrade Training • http://www.reflectionit.nl/Training/default.aspx#orcas
Questions mailto:fons.sonnemans@reflectionit.nl http://www.reflectionit.nl http://www.objectmap.nl