Galin Iliev's blog

Software Architecture & Development

Visual Studio 2008 SP1 is here

Well. The wait is over. Visual Studio 2008 SP1 is here.

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

and more... Read more on what's included in VS 2008 SP1.

Download install .exe.
Download .iso version.

LINQ to SQL, Web.config and Connection Strings

I had some interesting adventures and in one of them I had to figure out the connection string key for LINQ to SQL DataContext class. I found this interesting blog post by Rick Strahl.

In short he describes that LINQ to SQL designer uses different approaches for web site project and class library one. Here is like the website project designer file is:

public DataClassesDataContext() :
        base(global::System.Configuration.ConfigurationManager.ConnectionStrings["TimeTrackerConnectionString"].ConnectionString, mappingSource)
{
    OnCreated();
}

while the class library one is:

public TimeTrakkerContext() :
 base(global::TimeTracker.Properties.Settings.Default.TimeTrackerConnectionString, mappingSource)
{
    OnCreated();
}

and you should overwrite it by adding connection string in web.config with name TimeTracker.Properties.Settings.TimeTrackerConnectionString like this

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <connectionStrings>
        <add name="TimeTracker.Properties.Settings.TimeTrackerConnectionString"
            connectionString="Data Source=.;Initial Catalog=TimeTracker;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>

Hmm it works with me too but I remember I had one record in my web.config like this TimeTracker.Properties.Settings.Default.TimeTrackerConnectionString and it worked till I made some change. Go find...

VS2008 seminars in New Horizons Bulgaria

Yesterday was last seminar from VS2008 series held in the New Horizons Bulgaria office with Microsoft Bulgaria support.

The seminars was very interesting (not only from my perspective of trainer) but also from audience perspective we see in their feedback. During high demand I am publishing presentations and demo scripts where available. It is always good to write code in live (although not very easy - try it ;) ) and this is why I cannot provide working demos - I have only my own cheat lists which I use in cse I am stuck somewhere.

Deep Dive in LINQ - Here I talked about new features in C# in details and how they are build internally(also described in my Introduction in LINQ and C# 3.0 (In Bulgarian) ). Also I covered LINQ to SQL, LINQ to XML.  In demos we took a look at C# syntax sugar, new ways to work with XML as well as some problems stated in Project Euler and solved with C# 3.0. Slides + Demo scripts (PPTX+DOCX - 1.22MB)

Develop Dynamic Web Sites with ASP.NET 3.5 - This session was focused on web development. Here I show new controls to work with LINQ to SQL data source declaratively. We took a look at ASP.NET Extensions (aka Futures): ASP.NET MVC, ASP.NET Dynamic Data, ASP.NET AJAX Integration, ADO.NET Data Services. All features was shown in code except ADO.NET Data Services. For ASP.NET AJAX was shown how to control Browser's Back Button from both server-side and client-side. Slides+Demo Scripts (PPTX+DOCX - 3.23 MB).

Overview of WCF, WF, WPF - Although these technologies are not new there is still some improvements in .NET 3.5. These components are very useful but their adoption is not very fast. We talked about the architectural decisions and challenges behind them. The demos show how to work with WCF in VS2008, How to create REST Service and how to expose JSON as result. WF demos show how to create simple sequential workflow. WPF demo presented project structure, generated code, XAML (of course) and WPF data binding basics. Slides+Demo Scripts (PPTX+DOCS - 10.8 MB).

Hope you'll find it useful.
As always any comments and feedback are very welcome.

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

There is no doubt that VS 2008 and .NET 3.5  totally rocks! ScottGu's division keeps pushing these products and constantly improving developer's productivity and shortening development cycle.

This time MS is preparing to release .NET 3.5 SP1 and VS 2008 SP1 releases.

In short here are improvements:

Improvements for Client Development
  • ASP.NET Data Scaffolding Support (ASP.NET Dynamic Data)
  • SP.NET Routing Engine (System.Web.Routing)
  • ASP.NET AJAX Back/Forward Button History Support
  • ASP.NET AJAX Script Combining Support - Omar Al Zabir wrote an extensive article about this approach.
  • Visual Studio 2008 Performance Improvements HTML Designer and HTML Source Editor
  • Visual Studio 2008 JavaScript Script Formatting and Code Preferences
  • Better Visual Studio Javascript Intellisense for Multiple Javascript/AJAX Frameworks - who can blame MS that force us to use their JS framework now?!
  • Visual Studio Refactoring Support for WCF Services in ASP.NET Projects
  • Visual Studio Support for Classic ASP Intellisense and Debugging - I am wondering when this technology will be declared dead :) (This is what I used in my first web apps too :))
Improvements for Client Development
  • Application Startup and Working Set Performance Improvements
  • New .NET Framework Client Profile Setup Package
  • New .NET Framework Setup Bootstrapper for Client Applications
  • ClickOnce Client Application Deployment Improvements
  • Windows Forms Controls
  • WPF Performance Improvements
  • WPF Data Improvements
  • WPF Extensible Shader Effects
  • WPF Interoperability with Direct3D
VS 2008 for WPF Improvements
  • Several performance improvements
  • Events tab support within the property browser
  • Ability to sort properties alphabetically in the property browser
  • Margin snaplines which makes form layout much quicker
  • Better designer support for TabControl, Expander, and Grid
  • Code initiated refactoring now updates your XAML (including both control declarations and event declarations in XAML)
  • Go to Definition and Find All References now support things declared in XAML
Data Development Improvements
  • SQL 2008 Support
  • ADO.NET Entity Framework and LINQ to Entities
  • ADO.NET Data Services
WCF Development Improvements
  • Significant scalability improvements (5-10x) in Web-hosted application scenarios
  • Support for using ADO.NET Entity Framework entities in WCF contracts
  • API usability improvements with DataContract Serializers, and with the UriTemplate and WCF web programming models
  • Enhanced TestClient support within VS 2008 SP1
  • New Hosting Wizard in VS 2008 SP1 for WCF Service Projects
  • Improved debugging support in partial trust scenarios
VB and C# Improvements !!!
Team Foundation Server Improvements

Pretty impressive...

Read full novel by Scott Guthrie here :)

My Sessions at Microsoft Days 2008 in Sofia, Bulgaria

MS Days 2008 in Bulgaria is in history now and I could say I had a nice two days. There were many lecturers (about 50) and 72 sessions in 6 tracks.

For those who missed my talks or are interested in slides here are summary of the sessions:

LINQ to XML - Data Access Technologies

This session was focused on the new API from XML team for .NET languages. I gave a side by side comparison between traditional DOM vs. LINQ to XML regarding those most common actions:

  • Create XML
  • Traverse XML
  • Transform XML

I covered also VB9 Literals. At the moment I started talking about VB I was thinking people would throw rocks at me (and some really considered that option:) ). But at the moment when repeated some of demos with VB9 code the audience was very impressed and they forgot about those rocks in their pockets. Even there were initial brainstorming whether same things can be implemented in C# with custom code.(Unfortunately this is a compiler feature and we cannot do it very easily).

Another thing I mentioned was LINQ to XSD.

I've decided that people will understand my points better if I write code in front of them instead of just explaining it. This is also more challenging :). I think it went well...

Here are the downloads:

IIS7 for IT Pros

IIS7 is the most interesting feature in Windows Server 2008 and I already had some talks about it. In this talk I covered (from administration perspective) following key topics:

  • What is missing in IIS 6.0
  • IIS7 module architecture and it's benefits
  • New .NET-like configuration files and metadata
  • Delegated Administration
  • Shared Configuration
  • Tracing and Diagnostics

The things I've demonstrated are:

  1. New tools - new management console as well as APPCMD command-line tool
  2. Richness of new error pages and generated trace file - it is whole HTML+JS application built with XML & XSLT with incredible amount of information.
  3. WCAT stress test with view of live requests on the server.
  4. Analyze server and site load using IIS7 Admin Pack features.

And here is the presentation: MS PowerPoint 2007 format (0.98 MB)

Any feedback is very welcome.

VS2008 and .NET 3.5 (WCF, WPF, WF) Training Kit

Microsoft released a nice training kit for the latest technologies that will help you to become a real hero very quickly.

This package is a real treasure because it covers a bunch of technologies:

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

And the materials are of the different types:

  • Presentation - will be very helpful to prepare talks for community
  • Demos
  • Labs - very helpful to walk through new technologies in deep.

Go grab it!

Learn C# 3.0 by solving interesting problems

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

Bill Wagner started solving them employing new C# 3.0 features and post them in MSDN Code Library.

Follow his blog post series to learn them.

Of course it is preferable to try to solve them by yourself in order to tease your brain :)

Visual LINQ

LINQ is a nice way to write a more readable code but sometimes it is diffucult to understand the actions and the order they happens.

Visual LINQ project would give you an idea (watch the screencast of Visual LINQ in action) :

So for this query

VisualSource<string> words = new VisualSource<string>
    (new[] { "the", "quick", "brown", "fox", "jumped", 
             "over", "the", "lazy", "dog" }, 
     canvas, "words");
 
var query = from word in words
            where word.Length > 3
            select new { Word = word, Length = word.Length};
 
pipeline = query.End(); 

you will see similar screens:

Download source code.

(For more detailed info read Jon Skeet's blog post Visual LINQ: Watch query expressions as they happen!)

So, what's new in .NET 2.0?

That's right! There is new stuff in .NET 2.0 SP1 libraries and you should know about changes in red bits because there will be MethodMissingException exceptions if you deploy solution developed with VS 2008 with .NET 2.0 as target framework and deploy it on machine with .NET 2.0 (without SP1).

Scott Hanselman created a nice compilation with changes.

Note: this do not affect existing solutions at all because of .NET framework compatibility policy unless you've taken an advantage of fixed bug. In this case you should test affected components (UPDATED in order to include valueable comments from Daniel Moth)

blog posts on the subject:

LINQ to SQL vs LINQ to Entities

Elisa Flasko from Microsoft Data Platform Team wrote a nice article "Introducing LINQ to Relational Data" highlighting main features or two main ORMs coming out form Microsoft with Visual Studio 2008 (ADO.NET EF is not released so far but it will be released as additional package to VS2008)

In short:

LINQ to SQL is applicable when:

  • Use an ORM solution and my database is 1:1 with my object model
  • Use an ORM solution with inheritance hierarchies that are stored in a single table
  • Use my own plain CLR classes instead of using generated classes or deriving from a base class or implementing an interface
  • Leverage LINQ as the way I write queries
  • Use an ORM but I want something that is very performant and where I can optimize performance through stored procedures and compiled queries

LINQ to Entities is applicable when:

Write applications that can target different database engines in addition to Microsoft SQL Server

Define domain models for my application and use these as the basis for my persistence layer.

Use an ORM solution where my classes may be 1:1 with the database or may have a very different structure from the database schema

Use an ORM solution with inheritance hierarchies that may have alternative storage schemes (single table for the hierarchy, single table for each class, single table for all data related to specific type)

Leverage LINQ as the way I write queries and have the query work in a database vendor agnostic manner.

Use an ORM but I want something that is very performant and where I can optimize performance through stored procedures and compiled queries

 

Read article on MSDN or download Word 2007 version.