LINQ to SQL Beta 2 to RTM Changes

vs08_v_rgb_web.jpg

I was totally shocked to see when my solution which I had built using Orcas Beta 2 threw errors when compiled in VS 2008 RTM!

Exploring a bit, I found that the errors generated were related to my LINQ-to-SQL classes.

Error 8

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Visual Studio 2008 RTM Training Kit

inally, we can present the RTM version of the Visual Studio 2008 RTM Training Kit.
This kit is a real goldmine, containing presentations, Hands-On-Labs, demo's… on all topics related to Visual Studio 2008.
Now you only have to find about 5 days to complete all that's in here, and you're set!

All the info is below:
The Visual Studio 2008 Training Kit has been updated for the RTM and has been released on the Microsoft.com Download Center for anyone to download and use.

The Visual Studio 2008 Training Kit contains a full 5-days of technical content including 20 hands-on labs, 28 presentations, and 20 scripted demos. The technologies covered in the kit include: LINQ, C# 3.0, VB 9, WCF, WF, WPF, Windows CardSpace, Silverlight, ASP.NET Ajax, .NET Compact Framework 3.5, VSTO 3.0, Visual Studio Team System, and Team Foundation Server.

Originally developed for early adoption work with ISVs, it is now available to all.

You can download the entire training kit from the download center here: http://go.microsoft.com/?linkid=7602397. The kit is just over 120MB compressed. After downloading the kit, simply run the installation program to extract the contents to your local machine. Once the installation process is complete, you will see an HTML page that allows you to navigate through the contents of the kit.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Visual Studio 2008 Released: Installation ReadMe

Steps to Uninstall VS 2008 Beta2 before installing the VS 2008 Final Release
Several people have asked me for recommendations on the best way to upgrade a system that has VS 2008 Beta2 on it to the final VS 2008 RTM release. In my blog post announcing the VS 2008 and .NET 3.5 release yesterday I included this bit of guidance:

People often ask me for suggestions on how best to upgrade from previous betas of Visual Studio 2008. In general I'd recommend uninstalling the Beta2 bits explicitly. As part of this you should uninstall Visual Studio 2008 Beta2, .NET Framework Beta2, as well as the Visual Studio Web Authoring Component (these are all separate installs and need to be uninstalled separately). I then usually recommend rebooting the machine after uninstalling just to make sure everything is clean before you kick off the new install. You can then install the final release of VS 2008 and .NET 3.5 on the machine.

Once installed, I usually recommend explicitly running the Tools->Import and Export Settings menu option, choosing the “Reset Settings” option, and then re-pick your preferred profile. This helps ensure that older settings from the Beta2 release are no longer around (and sometimes seems to help with performance).

A few people have pointed out to me that there are other smaller setup packages that are optionally installed by Visual Studio 2008 Beta2 that you should also look to uninstall (it isn't always required to-do this – but it is best to always do this to be safe). A complete list of these additional setup packages (along with uninstall instructions) can be found here.

Below is the complete list of potential Beta2 components to uninstall (as well as the recommended uninstall order of them):

Remove “MSDN Library for Visual Studio 2008 Beta”
Remove “Microsoft SQL Server Compact Edition 3.5”
Remove “Microsoft SQL Server Compact Edition 3.5 Design Tools”
Remove “Microsoft SQL Server Compact Edition 3.5 for Devices”
Remove “Microsoft Visual Studio Performance Collection Tools”
Remove “Windows Mobile 5.0 SDK R2 for Pocket PC”
Remove “Windows Mobile 5.0 SDK R2 for Smartphone”
Remove “Crystal Reports 2007”
Remove “Visual Studio Asset System”
Remove “Microsoft Visual Studio Web Authoring Component / Microsoft Web Designer Tools”
Remove “Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System Runtime”
Remove “Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System Runtime Language Pack” (non-English editions only)
Remove “Microsoft Visual Studio Tools for Office Runtime 3.0”
Remove “Microsoft Document Explorer”
Remove “Microsoft Document Explorer 2005 Language Pack” (non-English editions only)
Remove “Microsoft Device Emulator 3.0”
Remove “Microsoft .NET Compact Framework 3.5”
Remove “Microsoft .NET Compact Framework 2.0 SP1”
Remove “.NET Framework 2.0 SDK”
Remove “Microsoft Visual Studio Codename Orcas Remote Debugger”
Remove “Microsoft Visual Studio 64bit Prerequisites Beta” (64-bit platforms only)
Remove “Microsoft .NET Framework 3.5”

After you finish uninstalling any and all of the above items, I'd recommend rebooting prior to installing the final VS 2008 and .NET 3.5 release to make sure there is no setup state still on the machine.

If you run into any problems with either installation or uninstall, please make sure to post in the Visual Studio 2008 Setup and Installation Forum on MSDN.

Hope this helps,

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Visual Studio 2008 Released

Quick Tour of Some of the New Features

Visual Studio 2008 and .NET 3.5 contain a ton of new functionality and improvements. Below are links to blog posts I've done myself as well as links to videos you can watch to learn more about it:

VS 2008 Multi-Targeting Support

VS 2008 enables you to build applications that target multiple versions of the .NET Framework. This means you can use VS 2008 to open, edit and build existing .NET 2.0 and ASP.NET 2.0 applications (including ASP.NET 2.0 applications using ASP.NET AJAX 1.0), and continue to deploy these application on .NET 2.0 machines. You can learn more about how this works from my blog post here:

VS 2008 Multi-Targeting Support
ASP.NET AJAX and JavaScript Support

.NET 3.5 has ASP.NET AJAX built-in (no separate download required). In addition to including all of the features in ASP.NET AJAX 1.0, ASP.NET 3.5 also now includes richer support for UpdatePanels integrating with WebParts, ASP.NET AJAX integration with controls like and , WCF support for JSON, and many other AJAX improvements.

VS 2008 and Visual Web Developer 2008 also now have great support for integrating JavaScript and AJAX into your applications. You can learn more about this from my blog posts here:

VS 2008 JavaScript Intellisense
VS 2008 JavaScript Debugging
VS 2008 ASP.NET AJAX Control Extender Support
VS 2008 JavaScript Intellisense for Silverlight
You can watch some videos that discuss ASP.NET AJAX and Visual Studio 2008 support for it here.

I also highly recommend the excellent ASP.NET AJAX in Action book to learn more about ASP.NET AJAX (both client-side and server-side).

VS 2008 Web Designer and CSS Support

VS 2008 and Visual Web Developer 2008 Express includes a significantly improved HTML web designer (the same one that ships with Expression Web). This delivers support for split-view editing, nested master pages, and great CSS integration. Below are some articles I've written that discuss this more:

VS 2008 Web Designer and CSS Support
VS 2008 Nested Master Page Support
VS 2008 Vertical Split View Support
VS 2008 Support to Treat CSS and JavaScript Validation Issues as Warnings instead of Errors
ASP.NET 3.5 also has a new control that provides the ability to perform rich data scenarios with total control over the markup. It works nicely with the new CSS support in VS 2008. You can learn more about it from my article here:

ASP.NET 3.5 ListView Control
You can watch some videos that discuss the new Visual Studio 2008 web designer features and the new ListView/DataPager controls here.

Language Improvements and LINQ

The new VB and C# compilers in VS 2008 deliver significant improvements to the languages. Both add functional programming concepts that enable you to write cleaner, terser, and more expressive code. These features also enable a new programming model we call LINQ (language integrated query) that makes querying and working with data a first-class programming concept with .NET.

Below are some of the articles I've written that explore these new language features using C#:

Automatic Properties, Object Initializer and Collection Initializers
Extension Methods
Lambda Expressions
Query Syntax
Anonymous Types
Here are a few additional blog posts I've written that show off some of the new VS 2008 code editing support and some cool ways to use these new language features:

VS 2008 Code Editing Features
Tip/Trick: Building a ToJson() Extension Method using .NET 3.5
The C# ?? null coalescing operator (and using it with LINQ)
Using LINQ to XML (and how to build a custom RSS Feed Reader with it)
The Visual Basic team has also created some great free videos that cover LINQ. You can watch them here.

Data Access Improvements with LINQ to SQL

LINQ to SQL is a built-in OR/M (object relational mapper) in .NET 3.5. It enables you to model relational databases using a .NET object model. You can then query the database using LINQ, as well as update/insert/delete data from it. LINQ to SQL fully supports transactions, views, and stored procedures. It also provides an easy way to integrate business logic and validation rules into your data model. Below are some of the articles I've written that explore how to use it:

Part 1: Introduction to LINQ to SQL
Part 2: Defining our Data Model Classes
Part 3: Querying our Database
Part 4: Updating our Database
Part 5: Binding UI using the ASP:LinqDataSource Control
Part 6: Retrieving Data Using Stored Procedures
Part 7: Updating our Database using Stored Procedures
Part 8: Executing Custom SQL Expressions
Part 9: Using a Custom LINQ Expression with the control
I think you'll find that LINQ and LINQ to SQL makes it much easier to build much cleaner data models, and write much cleaner data code. I'll be adding more posts to my LINQ to SQL series in the weeks and months ahead (sorry for the delay in finishing them earlier – so much to-do and so little time to-do it all!).

Scott Stanfield is also working on creating some great LINQ to SQL videos for the www.asp.net site based on my article series above (all videos are in both VB and C#). You can watch the first 4 videos in this series here.

The list above is only a small set of the improvements coming. For client development VS 2008 includes WPF designer and project support. ClickOnce and WPF XBAPs now work with FireFox. WinForms and WPF projects can also now use the ASP.NET Application Services (Membership, Roles, Profile) for roaming user data.

Office development is much richer – including support for integrating with the Office 2007 ribbon, and with Outlook. Visual Studio Tools for Office support is also now built-into Visual Studio (you no longer need to buy a separate product).

Installation Suggestions

Once installed, I usually recommend explicitly running the Tools->Import and Export Settings menu option, choosing the “Reset Settings” option, and then re-pick your preferred profile. This helps ensure that older settings from the Beta2 release are no longer around (and sometimes seems to help with performance).

Note that VS 2008 runs side-by-side with VS 2005 – so it is totally fine to have both on the same machine (you will not have any problems with them on the same box).

Silverlight Tools and VS Web Deployment Project Add-Ins
Two popular add-ins to Visual Studio are not yet available to download for the final VS 2008 release. These are the Silverlight 1.1 Tools Alpha for Visual Studio and the Web Deployment Project add-in for Visual Studio. Our hope is to post updates to both of them to work with the final VS 2008 release in the next two weeks. If you are doing Silverlight 1.1 development using VS 2008 Beta2 you'll want to stick with with VS 2008 Beta2 until this updated Silverlight Tools Add-In is available.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Developer Express .NET Controls in VS 2008 toolbox

Recently i discovered that my Developer Express .NET items weren't displayed in my VS 2008 toolbox.

After searching for a while I found out that they added a small tool that recreates all the items in your toolbar.

Program Files\Developer Express .NET\Tools\ToolboxCreator

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Assign ENTER to a button on a form with multiple buttons in asp.net

When you have submit button on your form, your browser will use that button whenever ENTER has been pressed.

BUT

When you have 3 buttons on your form and when the user presses the enter button, the browsers will use the first button encoded on your page..

when you want to control this action you can use the defaultbutton property of you Form

btnSave.Attributes.Add(
“onclick”, “if(confirm('Are you sure?')){}else{return false}
“);

Form.DefaultButton = btnSave.UniqueID;

Now when the user presses the enter button in a textbox, he will receive a confirm box to save the form.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Confirmation box before a delete – ASP.NET – C#

When you want to delete an entry, when the user presses a button it would be useful to display a confirmation bo where the user can reconsider if he wants to delete the object…

When developing in asp.net you can't use the Messagebox.Show() method :p but you can use this alternative:


btn_Delete.Attributes.Add("onclick", "if(confirm('Are you sure to delete?')){}else{return false}");

the asp.net code for the button:



When the popup messagebox is displayed and the user chooses “ok” the function btn_Delete_Click() will be executed otherwise the postback will be ignored.

VN:F [1.9.22_1171]
Rating: 7.0/10 (5 votes cast)
VN:F [1.9.22_1171]
Rating: +3 (from 3 votes)

Culture Info SQL 2005

ALways handy to optimize your code so that the Datetime formats are the same as in your sql server…

public CultureInfo GetCultureInfo(Server server) {
CultureInfo ci
SqlConnection conn = new SqlConnection(server.ConnectionContext.ConnectionString);
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "select lcid from sys.syslanguages where langid=@@langid";
cmd.CommandType = CommandType.Text;
using (conn) {
conn.Open();
int lcid = (int)(cmd.ExecuteScalar());
ci = new CultureInfo(lcid);
}
conn.Close();
return ci;
}

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)