Visual Studio 2008 Service Pack 1 and .NET Framework 3.5 Service Pack 1

Introduction

Visual Studio 2008 and the .NET Framework 3.5 enable developers to rapidly create connected applications that deliver high quality and rich user experiences. Visual Studio 2008 enables organizations of every size to rapidly create secure, manageable, and reliable applications that are optimized for Windows Vista™, SQL Server, the Microsoft 2007 Office system and the Web.

Visual Studio 2008 Service Pack 1 (SP1) and .NET Framework 3.5 SP1 continue Microsoft’s investment in market leading development tools and developer platform. SP1 addresses issues that were found through a combination of customer and partner feedback, as well as internal testing. These service packs offer customers improvements in responsiveness, stability and performance.

Overview

.NET-based Windows application development benefits from increased Windows Presentation Foundation (WPF) designer performance and updated components for Visual Basic and Visual C++ (including a MFC-based Office 2007 Ribbon).  Web development improvements include enhanced the client-side script tooling (JavaScript IntelliSense). In addition to IDE performance improvements SP1 fully supports SQL Server 2008 and the ADO.NET Entity Framework.

The .NET Framework 3.5 Service Pack 1 (SP1) delivers more controls, a streamlined setup, improved start-up performance, and powerful new graphics features for client development and rich data scaffolding, improved AJAX support, and other improvements for Web development. Additionally it introduces support for the ADO.NET Entity Framework and ADO.NET Data Services, which simplify data access code in applications by providing an extensible, conceptual model for data from any data source and enabling this model to closely reflect business requirements.

Visual Studio 2008 SP1 delivers:

  • Improved WPF designers
  • SQL Server 2008 support
  • ADO.NET Entity Designer
  • Visual Basic and Visual C++ components and tools (including an MFC-based Office 2007 style ‘Ribbon’)
  • Visual Studio Team System Team Foundation Server (TFS) addresses customer feedback on version control usability and performance, email integration with work item tracking and full support for hosting on SQL Server 2008
  • Richer JavaScript support, enhanced AJAX and data tools, and Web site deployment improvements

The .NET Framework 3.5 SP1 delivers:

  • Performance increases between 20-45% for WPF-based applications – without having to change any code
  • WCF improvements that give developers more control over the way they access data and services
  • Streamlined installation experience for client applications
  • Improvements in the area of data platform, such as the ADO.NET Entity Framework, ADO.NET Data Services and support for SQL Server 2008’s new features

Additional Details

WPF and visual designer improvements

Cold startup performance improvement ranging between 20-45% depending on application size without needing to modify any code.

Additional WPF support for text and graphics, and media to deliver better performance. For example, effects like DropShadow and Blur were implemented using software rendering; with SP1 these are now implemented using hardware acceleration. Other examples include:

  • Text, especially when used in Visual and DrawingBrush, is substantially faster,
  • Scrolling improvements with Container Recycling, improved working set with TreeView virtualization
  • A much improved WriteableBitmap that enables real-time bitmap updates from a software surface,
  • Designer support for the event tab within the property grid for control events,
  • Toolbox support within source mode.

.NET Framework 3.5 SP1 Optimized Client Runtime

SP1 provides a .NET Framework install version that is optimized for .NET-based client applications. The size of this optimized runtime is less than 28 MB.

New ADO.NET Data Features

ADO.NET Entity Framework

The ADO.NET Entity Framework is the next evolution of ADO.NET, raising the level of abstraction at which programmers work with data, and allowing the database structure or data source to evolve without significant impact to the application code.

Rather than coding against rows and columns, the ADO.NET Entity Framework allows the definition of a higher-level Entity Data Model over your relational data, and allows developers to then program in terms of this model. Developers get to deal with the data in the shapes that make sense for the application, and those shapes are expressed in a richer vocabulary that includes concepts like inheritance, complex types, and explicit relationships.

Use LINQ to Entities with the Entity Framework for queries that help create easy to maintain code that retrieves and works with strongly typed data objects or business entities.

ADO.NET Data Services

The Microsoft ADO.NET Data Services framework provides a first-class infrastructure for developing the next wave of dynamic internet applications by enabling data to be exposed as REST-based data services that can be consumed by client applications (ASP.NET, AJAX, Silverlight) in corporate networks and across the internet. Easily build applications using a comprehensive set of Microsoft .NET libraries and client components, accessing data through uniform URI syntax and using standard HTTP verbs to operate on the resource.

ADO.NET Data Services provides a framework to build data services for relational data sources, such as Microsoft SQL Server, MySQL, DB2, and Oracle, using the built-in support for the ADO.NET Entity Framework, or for non-relational data sources using the pluggable provider model.

TFS improvements

A number of improvements have been made to Visual Studio Team System 2008 Team Foundation including:

Version Control

  • Simplified the user experience through cleaner “Add to Source Control” dialogs, drag and drop support to the Source Control Explorer and a much easier to use “Workspace” dialog for working folder mappings.
  • Version control now automatically supports non-solution controlled files.
  • Various changes to the Source Control Explorer such as a new checkin date/time display column, local path hyperlink support and en editable source location field.

Work Item Tracking

  • Microsoft Office 2007 integration is now done using the standard Office “Ribbon” delivering a cleaner and easier to use integration to the different Microsoft Office 2007 products.
  • Email integration for work items and links for Team system Web Access to make it easier to use email as part of the development lifecycle.

Visual SourceSafe migration tool

  • The migration tool has been dramatically improved through many performance and reliability improvements. SP1 provides support for the elimination of namespace conflicts, automatic solution rebinding, improves timestamp coherency and increases the amount of migration logging information available.

Additional Features

  • Support for using SQL Server 2008 with Team Foundation Server.
  • Team System Web Access provides “live” links to work items and checkin emails. This improves the customer experience for users who do not use Team Explorer.
  • Scripting support for the creation of Team Projects.

Performance and scalability

  • With SP1 a large part of the focus was to improve the performance and scalability of Team Foundation Server through changes such as faster synchronization with Active Directory, improved checkin concurrency, a faster way to create source tree branches, online index rebuilding for less maintenance downtime and better support for very large checkin sets.
  • Improvements in the number of projects a server can support that make not only the scalability of the server better but also the client experience when connecting to a server with a large number of projects on it.

from http://msdn.microsoft.com/en-us/vstudio/products/cc533447.aspx

LINQPad – Cool Utility For LINQ

Maybe you know about this, but I saw it first few days a go. I feel in love.linqpadlogo

LINQPad is a cool little utility that was mainly created to allow you to test LINQ expressions and see them produce a  result and output the results in a nice easy to visualize format. It’s great for running LINQ Queries without having to fire up Visual Studio.

LINQPad is also a great way to learn LINQ: it comes preloaded with 200 examples from the book,"C# 3.0 in a Nutshell" written by Joseph Albahari, the author of LINQPad.  There’s no better way to experience the coolness of LINQ and functional programming.

LINQPad is more than just a LINQ query tool: it’s a code snippet IDE. Instantly execute any C# 3 or VB 9 expression or statement block! LINQPad does a great job at LINQ execution and visualization, but it has a lot more uses than just a LINQ query tool. It’s basically a snippet editor that allows you to save snippets and more importantly, execute just about any code that you can write as an expression or single function block.

For example, LINQ to SQL results:

linqpad1

Output can be displayed both as a result table view, the raw SQL (from .ToString()) and a useful code conversion from the LINQ Expression syntax to LINQ command syntax using command chaining of the various LINQ extensions methods.

Other example (from the preloaded examples):

linqpad2

There’s no installation – it’s a single self contained EXE you can copy anywhere assuming you have .NET 3.5 installed.

Download it here.

 

Share this post :

Visual Studio 2008 and .NET Framework 3.5 Training Kit

Microsoft released a nice training kit (~126MB) (it’s a real treasure!) for the latest technologies.

This package covers a bunch of technologies and includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2008 features and a variety of framework technologies vs2008 training kitincluding:

  • Visual Studio Tools for Office
  • Visual Studio Team System
  • Application Lifecycle Management
  • C# 3.0
  • VB 9.0
  • LINQ
  • WPF
  • WCF
  • WF
  • Silverlight
  • ASP.NET
  • AJAX
  • CardSpace
  • Mobile

Download here.

Linq to XML – Adding,Updating and Deleting data

The previous post about Linq to XML introduced how to query XML data using LINQ. LINQ allows us to not only query XML in a truly unique way, but also create XML documents in a very expressive manner. This post will talk about other operations on the XML: adding, updating and deleting data.

First, lets create a sample XML document:

   1:  XElement book = new XElement("Books", new XElement("Book",
   2:      new XAttribute("publisher", "O'Reilly Media, Inc."),
   3:          new XAttribute("price", "40$"),
   4:          new XElement("title", "Learning WCF: A Hands-on Guide"),
   5:          new XElement("authors", new XElement("author", "Michele Bustamante"))));
   6:   
   7:  book.Save("Books.xml");

Adding data to the XML document

Adding XML to the existing XML document is very simple, we need only construct our XML using a mixture of XElement and XAttribute types (there are other ways also…) and then add them to the document.

The following adds a new book:

   1:  XElement doc = XElement.Load("Books.xml");
   2:  XElement newBook = new XElement("Book",
   3:      new XAttribute("publisher", "Microsoft Press"),
   4:      new XAttribute("price", "45$"),
   5:      new XElement("title", "Introducing Microsoft LINQ"),
   6:      new XElement("authors", new XElement("author", "Paolo Pialorsi"), 
   7:          new XElement("author", "Marco Russo")));
   8:   
   9:  doc.Add(newBook);
  10:  doc.Save("Books.xml");

We must save the xml with the save method, because in LINQ to XML, no changes are made to the loaded XML document until that document is saved.

The XML document now is:

   1:  <?xml version="1.0" encoding="utf-8"?>
   2:  <Books>
   3:    <Book publisher="O'Reilly Media, Inc." price="40$">
   4:      <title>Learning WCF: A Hands-on Guide</title>
   5:      <authors>
   6:        <author>Michele Bustamante</author>
   7:      </authors>
   8:    </Book>
   9:    <Book publisher="Microsoft Press" price="45$">
  10:      <title>Introducing Microsoft LINQ</title>
  11:      <authors>
  12:        <author>Paolo Pialorsi</author>
  13:        <author>Marco Russo</author>
  14:      </authors>
  15:    </Book>
  16:  </Books>

Updating data

Updating XML data is also very simple; Just pick the element/attribute you wish to update and then set its new value.

   1:  XElement doc = XElement.Load("Books.xml");
   2:   
   3:  //obtain a single book
   4:  IEnumerable<XElement> singleBook = (from b in doc.Elements(
   5:                                        "Book")
   6:                                      where ((string)b.Element(
   7:                                      "title")).Equals("Introducing Microsoft LINQ")
   8:                                      select b);
   9:   
  10:  //update book, should only be 1
  11:  foreach (XElement xe in singleBook)

12: {

  13:      xe.SetAttributeValue("price", "39$");
  14:      
  15:      //use the ReplaceContent method to do the replacement for all attribures
  16:      //this will remove all other attributes and save only the price attribute
  17:      xe.ReplaceAttributes(new XAttribute("price", "32$"));
  18:  }
  19:   
  20:  doc.Save("Books.xml");

Deleting data

We simply have to get the object we want to delete and then delete it using the Remove() method.

   1:  XElement doc = XElement.Load("Books.xml");
   2:   
   3:  //obtain the first Book
   4:  IEnumerable<XElement> firstBook = (from b in doc.Elements(
   5:                                        "Book")
   6:                                        select b).Take(1);
   7:   
   8:  //delete book price
   9:  foreach (XElement xe in firstBook)
  10:  {
  11:      xe.Attribute("price").Remove();
  12:  }
  13:   
  14:  doc.Save("Books.xml");

Other way: we pass a lambda expression in as an argument to the Where extension method.

As you can see, Xlinq is really simple and great way to work with XML.

Enjoy!

Query XML using XLINQ

LINQ to XML is a built-in LINQ data provider that is implemented within the System.Xml.Linq namespace in .NET 3.5.
It enables us do the following to XML data:

  • Read.
  • Construct.
  • Write.

We can perform LINQ queries over XML from the file-system, from a remote HTTP URL or web-service, or from any in-memory XML content.
LINQ to XML provides much richer (and easier) querying and data shaping support than the low-level XmlReader/XmlWriter API in .NET 2 and also much more efficient with usage of much less memory than the DOM API that XmlDocument provides. That’s because it does not require you to always have a document object to be able to work with XML. Therefore, you can work directly with nodes and modify them as content of the document without having to start from a root XmlDocument object. This is a very powerful and flexible feature that you can use to compose larger trees and XML documents from tree fragments. Now that you have an overview of the XLinq’s capabilities, the next few sections will examine the reading and writing features of XLinq before discussing the query capabilities.

01 (Figure and classes explanations are taken from XLINQ overview.doc)

Of the classes shown in this figure, the XNode and XContainer classes are abstract. The XNode class is the base for element nodes, and provides a Parent method and methods such as AddBeforeThis, AddAfterThis, and Remove for updates in the imperative style. For IO, it provides methods for reading (ReadFrom) and writing (WriteTo).
Although the XElement class is bottom-most in the class hierarchy, it is the fundamental class. As the name suggests, it represents an XML element and allows you to perform the following operations:

  • Create elements with a specified element name
  • Change the element’s contents
  • Add, change, or delete child elements
  • Add attributes to the element
  • Save the element as an XML fragment
  • Extract the contents in text form

This post will introduce hoe to query xml and it is the first of series of posts regards to XLINQ.

Lets get a sense of how LINQ to XML works!

Query xml from URL

   1:  public static void GetRssFeedFromURL()
   2:  {
   3:      string url = "http://feeds.feedburner.com/MaorDavid?format=xml";
   4:   
   5:      // load the rss feeds into the XElement
   6:      XElement feeds = XElement.Load(url);
   7:   
   8:   
   9:      if (feeds.Element("channel") != null)
  10:      {
  11:          var query = from f in feeds.Element("channel").Elements("item").Take(10)
  12:                      select new { Title = f.Element("title").Value, Link = f.Element("link").Value };
  13:   
  14:          foreach (var feed in query)
  15:          {
  16:              Console.WriteLine(String.Format("Feed title: {0}",feed.Title));
  17:              Console.WriteLine(String.Format("Link: {0}",feed.Link));
  18:          }
  19:      }
  20:  }

XLinq is an XML query language that inherits from the LINQ query foundation. You can use it to query XLinq objects such as XElement, XDocument, etc using LINQ query facilities.

We start by loading the XML into memory using the Load() method of the XElement class. (Line 6).

After loading the XML , the next step is to retrieve all items (Line 11) and now you can query and iterate the results as described in my previous posts.(Var keyword, Getting started with Linq).

Very simple! This example load an XML from URL. What if you want to query XML from the file system? Nothing changed beside the uri parameter to load into the XElement. (Line 6)

   1:  public static void GetRssFeedFromFile()
   2:  {
   3:      string path = @"C:WorkProjectsSamplesVS2008SamplesLinqToXMLMaor Davids Blog.xml";
   4:   
   5:      // load the rss feeds into the XElement
   6:      XElement feeds = XElement.Load(path);
   7:   
   8:   
   9:      if (feeds.Element("channel") != null)
  10:      {
  11:          var query = from f in feeds.Element("channel").Elements("item").Take(10)
  12:                      select new { Title = f.Element("title").Value, Link = f.Element("link").Value };
  13:   
  14:          foreach (var feed in query)
  15:          {
  16:              Console.WriteLine(String.Format("Feed title: {0}", feed.Title));
  17:              Console.WriteLine(String.Format("Link: {0}", feed.Link));
  18:          }
  19:      }
  20:  }

 

As you can see, all the code snippets presented above are fairly simple. Once the XML loaded into the LINQ to XML API, you can write queries over that tree. The query syntax is easier than XPath or XQuery.

Enjoy!!

Microsoft to release .NET Framework Library Source Code

Scott Guthrie just made an exciting post, starting with .NET 3.5 and VS 2008 the .NET libraries will have source available! 

One of the things my team has been working to enable has been the ability for .NET developers to download and browse the source code of the .NET Framework libraries, and to easily enable debugging support in them.

Today I’m excited to announce that we’ll be providing this with the .NET 3.5 and VS 2008 release later this year.

Anyone who accepts the Microsoft Reference License will be able to browse and view the source code. The initial publication will include the BCL (System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, System.Text, etc), ASP.NET (System.Web), Windows Forms (System.Windows.Forms), ADO.NET (System.Data), XML (System.Xml), and WPF (System.Windows).

Read all about it here:

http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source-code-for-the-net-framework-libraries.aspx

Here’s a little more by Shawn Burke:

http://blogs.msdn.com/sburke/archive/2007/10/03/making-net-framework-source-available-to-developers.aspx

Technorati Tags: ,

Query types using LINQ

It’s great. It’s so beautiful. I really like it.

Reflecting types using LINQ.

How can we do it?

We can use Reflection of course, but with LINQ it shortest and simplest.

Declare “Type” object , assign the class you want to query and query with LINQ.

Example 1:

To get all methods of a class:

   1:  Type tPerson = typeof(Person);
   2:  var methods = from method in tPerson.GetMethods()
   3:                select method;
   4:   
   5:  Console.WriteLine("All methods:");
   6:  foreach (var m in methods)
   7:  {
   8:      Console.WriteLine(m.Name);
   9:  }

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 

Example 2:

To get all methods that returns “int”, use the “where’ clause:

   1:  var ints = from method in tPerson.GetMethods()
   2:                where method.ReturnType == typeof(int)
   3:                select method;
   4:   
   5:  Console.WriteLine("All methods that returns int:");
   6:  foreach (var intType in ints)
   7:  {
   8:      Console.WriteLine(intType.Name);
   9:  }
%d bloggers like this: