Showing posts with label Visual Studio 2008. Show all posts
Showing posts with label Visual Studio 2008. Show all posts

Wednesday, April 1, 2009

Silverlight 3 Beta

http://silverlight.net/getstarted/silverlight3/default.aspx

Silverlight 3 Beta was unveiled at MIX09. It is a preview release which continues Silverlight’s track record of rapid innovation - introducing more than 50 new features, including support for running Silverlight applications out of the browser, dramatic video performance and quality improvements, and features that radically improve developer productivity.

Important notes:

  • This is a developer beta release only! This means there is no “go-live” licensing available and the end-user runtime of Silverlight 3 is not available. The tools below are intended for software developers only.
  • Once you install the Silverlight 3 Beta Tools for Visual Studio, your development environment will be a Silverlight 3 Beta environment.  Visual Studio 2008 SP1 does not support multi-targeting for Silverlight applications so you will be unable to develop Silverlight 2 applications once these tools are installed.  We recommend that you install the Silverlight 3 Beta tools on a separate environment if you still need to have the ability to develop Silverlight 2 applications.
  • Ensure that you have either Visual Studio 2008 SP1 or Visual Web Developer Express 2008 SP1 installed as it is a prerequisite for the Silverlight 3 Beta Tools for Visual Studio.

Thursday, September 11, 2008

Visual Studio 2008 SP1 Preparation Tool

Microsoft has released a tool that will prepare your system for VS 2008 SP1. It's important to run it if you have installed any beta Visual Studio 2008 software since it went RTM.

http://www.microsoft.com/downloads/details.aspx?FamilyId=A494B0E0-EB07-4FF1-A21C-A4663E456D9D 

The following pre-release programs and updates will prevent Visual Studio 2008 SP1 from installing successfully, so they must be removed prior to installation:


To remove these programs, it is recommended that you run the automated Visual Studio 2008 Service Pack Preparation Tool. This tool will remove the specified updates and programs from your system and restore the integrity of any Visual Studio 2008 features that may have been compromised during manual removal of the Visual Studio 2008 SP1 Beta release.

Tuesday, August 12, 2008

SQL Server 2008 released

Microsoft has released SQL Server 2008.

Evaluation download available here.

Hardware and Software requirements are here.

Note that if you have Visual Studio 2008 installed, you will need to upgrade to Visual Studio 2008 SP1 before installing SQL Server 2008.

Monday, August 11, 2008

Visual Studio 2008 Service Pack 1 available

VS 2008 SP1 is now available for download with the .NET 3.5 SP1 framework.

More info 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.

Thursday, July 3, 2008

Fun with C# 3.0 (#3) - Lambda expressions

The addition of LINQ to C#/.NET has really improved the way that we can handle data in our applications. Here's an example.

Suppose we want to write a method to count the number of strings in a list which exceed a certain length. It's not to hard to do with C# 2.0; you iterate over the items, make the comparison, increment a counter and return it. But C# 3.0 makes it simple.

When the namespace System.Linq is included in your file, IEnumerable objects get a load of new extension methods. One of them is Where, which will return a sub-collection of items that match a filter. The filter is defined as a lambda expression that returns a bool. If the item causes the lambda expression to evaluate to true, then the item will be included in the sub-collection. Let's look at some code:

public int NumberLongerThan(List<string> list, int n)
{
var subList = list.Where(
(string str) => str.Length > n
);
return subList.Count();
}


Here we pass in a List<string> and a number. The subList will have the string items that are longer than n characters. Note that we don't have to define the type of subList; the compiler can infer it at compile-time.



Here is the code that uses the method.



List<string> list = new List<string>() { "abc", "def", "GH", "ijKL", "mnop", "QRSTUV", "Wxyz" };
Console.WriteLine(NumberLongerThan(list, 0));
Console.WriteLine(NumberLongerThan(list, 1));
Console.WriteLine(NumberLongerThan(list, 2));
Console.WriteLine(NumberLongerThan(list, 3));


This is the lambda expression:



(string str) => str.Length > n


It states that a string is passed in and returns a bool based on the test of the string Length. The Where() method takes an expression that expects a string and returns a bool. Since the compiler knows this, we can let it infer the type of the parameter and specify the expression like so:



str => str.Length > n


Also, note that if we have a named method that is of the correct delegate type (Func<T, bool>), we can pass it to Where(). Here, List<T> is List<string>, so the method must take a string parameter.



public bool TestString(string s) { return s.Length > 3; }


var filtered = list.Where(TestString);
//-- or --
Func<string, bool> f = TestString;
var list2 = list.Where(f);


The advantage of using the unnamed lambda expression is that we can reference the local variable n as a parameter in our test expression.



More info at Charlie Calvert's blog.

Tuesday, July 1, 2008

Tuesday, June 24, 2008

Fun with C# 3.0 (#2)

This one is a quickie. Auto-implemented properties.

It allows you specify the property and have the compiler automatically define a backing private instance member. It is way cool.

public class Employee
{
public string Name { set; get; }
public string Job { set; get; }
public int Age { set; get; }
}

Fun with C# 3.0 (#1)

This is the first in a series of posts in which I explore new features of C# 3.0 available in Visual Studio 2008.

In this post, I introduce anonymous types and extension methods.

An anonymous type is an unnamed class that you can define simply by specifying the values of its properties. These properties are read-only and can be accessed through the usual property accessor syntax.

var employee = new { Name = "John Smith", Age = 44, Job = "Manager" };
Console.WriteLine(employee.Name);
Console.WriteLine(employee.Age);
Console.WriteLine(employee.Job);


ProcessData(employee);



The class is created at compile-time and the properties are available via IntelliSense. Note, however that if you want to pass the object to another method, it must be passed as an object, since the class is unnamed.



public void ProcessData(object data)


{


}




Once we have the object in our ProcessData method, we need to access the properties via Reflection. Here's where extension methods come in handy. An extension method is a method that is declared as a static method in static class and is in an accessible namespace. It will appear to add new methods to an object type. For example, I can add a method to the String class that removes spaces:



public static class Extend
{
public static string RemoveSpaces(this string s)
{
return s.Replace(" ", "");
}

}




The "this" parameter modifier indicates that it is an extension method and the type of the parameter (string) is the class that is modified. It is called like so:



Console.WriteLine(employee.Name.RemoveSpaces());

To ease the access to our anonymous type properties, we can create an extension method on the object class. The method will be called ValueOf() and will take the name of the property as a parameter:

public static class ReflectionExtensions
{
public static object ValueOf(this object obj, string name)
{
if (name == null) throw new ArgumentNullException("Property Name");

try
{
return obj.GetType().GetProperty(name).GetValue(obj, null);
}
catch (NullReferenceException)
{
return null;
}
}
}

Now in our ProcessData() method we can access the Property values:

public void ProcessData(object data)
{
Console.WriteLine("Employee Name = " + data.ValueOf("Name"));
Console.WriteLine("Employee Age = " + data.ValueOf("Age"));
Console.WriteLine("Employee Job = " + data.ValueOf("Job"));

}








Saturday, June 7, 2008

Silverlight 2 Beta 2 available

Microsoft has released the Second Beta of Silverlight 2.

Announcement on Scott Guthrie's blog.

The highlights:
  • 4.8 MB Download that does not require .NET Framework on the target system
  • The tools for VS 2008 will work with VS 2008 and VS 2008 SP1 beta
  • Adds more controls to beta 1
  • Cross-domain socket support
  • Background thread networking
  • Support for WCF duplex connections
  • Datagrid improvements
  • Databinding improvements
  • Isolated storage is now 1MB with ability to prompt user to increase storage space

Note that if you want to use VS 2008 SP1 with SL 2 Beta 2, you should install VS 2008 SP1 beta first then the SL2B2 tools.

Thursday, June 5, 2008

Unity, WCF and IIS

In a previous post, I showed how to integrate Unity with WCF when you are self-hosting a service. What's not clear is how to get IIS to use the Unity-enabled host when it starts hosting your service.

This is accomplished with a ServiceHostFactory. The @ServiceHost directive has an attribute named, curiously enough, Factory. This can be used to designate a class which will provide a configured ServiceHost. More on that in a moment. Let's see an example of a service that needs constructor-injection.

I've taken the default Service that Visual Studio 2008 gives you when you create a WCF Web Service, and added a SuffixProvider dependency that is satisfied in the constructor.



namespace WcfService1
{
public class Service1 : IService1
{
private ISuffixProvider provider;
public Service1(ISuffixProvider provider)
{
this.provider = provider;
}

public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}

public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite.BoolValue)
{
composite.StringValue += provider.GetSuffix();
}
return composite;
}
}
}

namespace WcfService1
{
public interface ISuffixProvider
{
string GetSuffix();
}
}


namespace WcfService1
{
public class MySuffixProvider : ISuffixProvider
{
#region ISuffixProvider Members

public string GetSuffix()
{
return "estericize";
}

#endregion
}
}



Using the UnityWCF project created in the previous post, I will create a factory that is derived from ServiceHostFactory, and configure a Unity container to supply a concrete implementation of ISuffixProvider. I have done this in code, most likely you will want to configure it from an XML file.



using System;
using System.ServiceModel;
using System.ServiceModel.Activation;
using Microsoft.Practices.Unity;
using UnityWCF;

namespace WcfService1
{
public class UnityServiceHostFactory : ServiceHostFactory
{
protected override ServiceHost CreateServiceHost(
Type serviceType, Uri[] baseAddresses)
{
UnityServiceHost host = new UnityServiceHost(serviceType, baseAddresses);
UnityContainer unity = new UnityContainer();
host.Container = unity;

//configure container
unity.RegisterType<ISuffixProvider,MySuffixProvider>();

return host;
}
}
}


Finally, edit the Service1.svc file to reference the factory class:

<%@ ServiceHost Language="C#"
Debug="true"
Factory="WcfService1.UnityServiceHostFactory"
Service="WcfService1.Service1"
CodeBehind="Service1.svc.cs" %>

Saturday, May 31, 2008

Visual Studio 2008 SP1 Beta and .NET 3.5 SP1 Beta

Here is Scott Guthrie's announcement.

The service packs are scheduled to RTM this summer.

I think the following are useful features:
- Faster application startup times
- .NET Framework Client Profile: only includes the client side libraries for a smaller download.
- ClickOnce improvements
- WPF Improvements
- The ADO.NET Entity Framework and LINQ to Entities (yay!)
- Astoria: a REST-based data service
- WCF improvements

Microsoft Visual Studio 2008 Training Kit

Microsoft has released a training kit for Visual Studio 2008.

Overview
The Visual Studio 2008 and .NET Framework 3.5 Training Kit 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 including: LINQ, C# 3.0, Visual Basic 9, WCF, WF, WPF, ASP.NET AJAX, VSTO, CardSpace, SilverLight, Mobile and Application Lifecycle Management.