Tuesday, April 7, 2009

LINQ Links

The MSDN Site: http://msdn.microsoft.com/en-us/vbasic/aa904594.aspx 

Wikipedia: http://en.wikipedia.org/wiki/Language_Integrated_Query 

LINQ (Language Integrated Query) was delivered in .NET 3.5 and Visual Studio 2008. It addreses O/R mapping issues by making query operations like SQL statements part of the programming language. It also offers built-in support for querying in-memory collections like arrays or lists, XML, DataSets, and relational databases.It also allows you to develop queries in your native development language (with IntelliSense).

LINQ to XML: It is recommended that developers switch over from coding against the XmlDocument DOM to LINQ's XDocument

LINQ to SQL: Deprecated... use LINQ to Entities

LINQ to Entities: Entity Framework Learning Guide

Books:

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.

Wednesday, March 25, 2009

Google Chrome withstands security testing

From Ars Technica:

A recent contest at CanSecWest, an event that brings together some of the most skilled experts in the security community, has demonstrated that the three most popular browser are susceptible to security bugs despite the vigilance and engineering prowess of their creators. Firefox, Safari, and Internet Explorer were all exploited during the Pwn2Own competition that took place at the conference. Google's Chrome browser, however, was the only one left standing—a victory that security researchers attribute to its innovative sandbox feature.

Monday, March 23, 2009

Dependency Injection, is it for you?

People have been trying to convince you how great Dependency Injection is. Maybe they're calling it Inversion of Control. Either way, you're not buying it.

If you haven't been able to see the benefit, try reading Justin's blog post: To Inject or Not To Inject (warning: it is long, but worth it).

Justin focuses on complex configuration scenarios, but I like to recommend DI for its reusability. Self-configuring and "service locator" configuring tends to constrain you to using a particular type of configuration infrastructure, making it difficult to reuse your components, not to mention unit testing.

Roundup - .NET Application Development Platforms

I've put together a collection of links from around the web on tools and technologies for developing .NET Line-of-business applications.

Silverlight 3 (beta) - Microsoft

Silverlight Labs - Microsoft

Silverlight Toolkit - CodePlex

WPF Hands-on lab (Southridge) - Microsoft Redmond

WPF Hands-on lab (Order Manager) - Microsoft Switzerland

WPF - CodePlex

Composite Application Guidance for WPF and Silverlight (Prism) - Microsoft P&P

Building a Framework for Silverlight - SilverlightShow

Caliburn - Rob Eisenberg

CSLA.NET (WPF and Silverlight) - Rocky Lhotka

DevForce WinClient - IdeaBlade

DevForce Silverlight - IdeaBlade

Nintex Workflow - Nintex

UPDATE: I added RIA services after listening to Brad Abram's talk on .NET Rocks. It was announced at MIX09.

RIA Services - Microsoft

RIA Services on SliverlightShow.

Friday, January 9, 2009

Welcome to Windows 7

7

Do you like to get your hands on the latest and greatest?

Microsoft is posting a beta of its next generation Windows OS later today at the Windows 7 Web page.

Enjoy.

Thursday, January 8, 2009

SharpDevelop

If you are interested in a free Open Source Development Environment for .NET check out #develop (pronounced SharpDevelop). It supports C#. VB.NET and Boo.

Currently it only does .NET 1.1 and 2.0, but they are working on support for .NET 3.5, which will also add IronPython and F#.

Tuesday, December 30, 2008

Unity Application Block 1.2 for Silverlight - December 2008

Not many changes here for Silverlight, just adjustments to the packaging to allow it to run in Silverlight...

Unity Application Block 1.2 for Silverlight - December 2008

And -- not sure how I missed it, but Unity 1.2 was released in October.

Ah, I remember, I was on vacation...

Friday, December 19, 2008

LINQ to SQL - Dead or alive?

Microsoft claims that LINQ to SQL is not a dead technology, despite their focus on Entity Framework. From Redmond Developer News:

Tim Mallalieu, the program manager for both LINQ to SQL and the Entity Framework, ... says Microsoft anticipated the backlash but said both data access interfaces will be better off for this move. For those who don't think the Entity Framework is a suitable replacement, Mallalieu said stay tuned.

"There's some pretty nifty stuff we're doing in the beta 2 time frame that we are not speaking about as yet, I think it will give you a better experience and will reduce the anxiety that people have around the Entity Framework," Mallalieu said. "In terms of capabilities, I think will make the overall integrated experience of ASP.NET, Dynamic Data, MVC and these other things easier, we did a little bit of triaging and feedback, there is some valid feedback around complexity in the Entity Framework and we are doing things to address that. "

Especially in light of the fact that LINQ to SQL is specific to SQL Server, I think it's best to wait a while to see what happens with Entity Framework. Note that there are quite a few folks who aren't happy with the way it has turned out so far.

Wednesday, October 8, 2008

Unity 1.2 and Interception

Unity 1.2 is under development, but we do know that it will support Interception.

David Hayden has a nice screencast showing how it works.

David shows how you can add an interceptor to time the execution of a method in an object that Unity has created for you. Cool stuff. Check it out!

Monday, October 6, 2008

Fun with C# 3.0 (#4) - Nullable types and the ?? operator

C# has reference types and value types. Reference types are commonly called objects, and variables that are declared to be of a reference type can refer to an object or be null. Value types (int or bool, for example) can be stored in variables that contain the actual value, and therefore can never be null.

Sometimes it is useful to have a value type that can have a null value, so this feature has been added to C# 3.0.

This feature is implemented using generics and the type System.Nullable<T>, the shorthand for which is T?. The property HasValue can be used to see if the variable is null. Here's an example:

int? x = 10;
if (x.HasValue)
{
System.Console.WriteLine(x.Value);
}
else
{
System.Console.WriteLine("Undefined");
}

A nullable type can not be assigned to a value type. The following will not compile:


int? x = 10;
int y;
y = x;

Rather use the Value property:


int? x = 10;
int y;
y = x.Value;

Accessing Value will throw an InvalidOperationException if the nullable type is null. Use the ?? to assign a default value.


int? x = null;
int y;
y = x ?? 0;

This is equivalent to:


y = x.HasValue ? x.Value : 0;

Usage of the ?? operator is not limited to Nullable types. For example:


string name = enteredName ?? "Name not entered.";

Friday, October 3, 2008

The Common Service Locator

I have argued against making 'hard' references to an underlying Dependency Injection (or IoC) container; rather, allow the container to do the work for you, namely, inject the dependencies. I realize that it can be difficult in practice, and apparently so have others.

A group of DI container authors have come together to define a common interface for using the underlying containers without creating a hard reference to a particular implementation. This is useful when you are writing code that needs to use a container to resolve a dependency (i.e. get an instance) but you don't know or care what container is being used.

So now we have the Common Service Locator library. Thanks to Ayende for blogging it. UPDATE: Also Glenn Block.

Each container needs an adapter to implement the interface and do the translation from the common method calls to the native container calls. This allows all container references to be declared as Microsoft.Practices.ServiceLocation.IServiceLocator.

Your code has two ways of getting the container:

  • The IServiceLocater reference can be supplied by the calling code and you just use it, or
  • You code can use a static property, ServiceLocator.Current.

Here is the interface that you will use (API Reference):

using System;
using System.Collections.Generic;

namespace Microsoft.Practices.ServiceLocation
{
// Summary:
// The generic Service Locator interface. This interface is used to retrieve
// services (instances identified by type and optional name) from a container.
public interface IServiceLocator : IServiceProvider
{
// Summary:
// Get all instances of the given TService currently registered in the container.
//
// Type parameters:
// TService:
// Type of object requested.
//
// Returns:
// A sequence of instances of the requested TService.
//
// Exceptions:
// Microsoft.Practices.ServiceLocation.ActivationException:
// if there is are errors resolving the service instance.
IEnumerable<TService> GetAllInstances<TService>();
//
// Summary:
// Get all instances of the given serviceType currently registered in the container.
//
// Parameters:
// serviceType:
// Type of object requested.
//
// Returns:
// A sequence of instances of the requested serviceType.
//
// Exceptions:
// Microsoft.Practices.ServiceLocation.ActivationException:
// if there is are errors resolving the service instance.
IEnumerable<object> GetAllInstances(Type serviceType);
//
// Summary:
// Get an instance of the given TService.
//
// Type parameters:
// TService:
// Type of object requested.
//
// Returns:
// The requested service instance.
//
// Exceptions:
// Microsoft.Practices.ServiceLocation.ActivationException:
// if there is are errors resolving the service instance.
TService GetInstance<TService>();
//
// Summary:
// Get an instance of the given named TService.
//
// Parameters:
// key:
// Name the object was registered with.
//
// Type parameters:
// TService:
// Type of object requested.
//
// Returns:
// The requested service instance.
//
// Exceptions:
// Microsoft.Practices.ServiceLocation.ActivationException:
// if there is are errors resolving the service instance.
TService GetInstance<TService>(string key);
//
// Summary:
// Get an instance of the given serviceType.
//
// Parameters:
// serviceType:
// Type of object requested.
//
// Returns:
// The requested service instance.
//
// Exceptions:
// Microsoft.Practices.ServiceLocation.ActivationException:
// if there is an error resolving the service instance.
object GetInstance(Type serviceType);
//
// Summary:
// Get an instance of the given named serviceType.
//
// Parameters:
// serviceType:
// Type of object requested.
//
// key:
// Name the object was registered with.
//
// Returns:
// The requested service instance.
//
// Exceptions:
// Microsoft.Practices.ServiceLocation.ActivationException:
// if there is an error resolving the service instance.
object GetInstance(Type serviceType, string key);
}
}



Here are the containers that have adapters at the moment:





I recommend IServiceLocator be used in all components that might need a reference to a container. Note that they are no common calls for configuring the container because this is a container-specific task that should be handled in the calling code.

Thursday, October 2, 2008

Microsoft "Dublin" addresses composite SOA applications

Microsoft just released a white paper outlining how .NET Framework 4.0 and new Windows Server capabilities (code-named Dublin) will help developers design, build and maintain Composite Applications. The white paper is available here.

What are composite SOA applications? Applications that are composed by assembling and integrating reusable services. This makes the deployment and management of applications (and servers) more complex and creates new requirements to address scalability, performance and reliability.

Microsoft has announced .NET Framework 4.0 to add functionality to WCF and WF, and also "Dublin", an add-on to Windows Server 2008, that will make SOA applications and servers easier to deploy, configure, manage and scale. The first preview will be available at the PDC at the end of October.

See the chart below from the white paper:

 

Windows Communication Foundation 4.0

Windows Workflow
Foundation 4.0

Windows Server
"Dublin" technologies

RESTful enhancements

·   Simplifying the building of REST Singleton & Collection Services, ATOM Feed and Publishing Protocol Services, and HTTP Plain XML Services using WCF

·   WCF REST Starter Kit to be released on Codeplex to get early feedback

Messaging enhancements

·   Transports - UDP, MQ, Local in-process

·   Protocols - SOAP over UDP, WS-Discovery, WS-BusinessActivity, WS-I BP 1.2

·   Duplex durable messaging

Correlation enhancements

·   Content and context driven, One-way support

Declarative Workflow Services

·   Seamless integration between WF and WCF and unified XAML model

·   Build entire application in XAML, from presentation to data to services to workflow

 

Significant improvements in performance and scalability

·   Ten-fold improvement in performance

New workflow flow-control models and pre-built activities

·   Flowcharts, rules

·   Expanded built-in activities – PowerShell, database, messaging, etc.

Enhancements in workflow modeling

·   Persistence control, transaction flow, compensation support, data binding and scoping

·   Rules composable and seamlessly integrated with workflow engine

Updated visual designer

·   Easier to use by end-users

·   Easier to rehost by ISVs

·   Ability to debug XAML

Provide standard host for WF and WCF applications   

Pre-built developer services

·   Message-based correlation

·   Message forwarding service

·   Content-based message routing

·   Compensation service for long-running transactions

Greater scalability and easier manageability

·   Enable scale-out of stateful workflow applications

·   Persisting and rehydrating state for high scalability

·   Enhanced management and monitoring functions

·   Tracking store for workflow events

Supports “Oslo” modeling platform

 

 

Key takeaways:

  • Microsoft will make it easier to design applications as WF workflows that are easily integrated into WCF services.
  • WCF and WF both use XAML. Microsoft will move to a "unified" XAML to make the integration easier.
  • Microsoft is moving more toward REST for web services due to its simplicity. The REST Starter Kit will be available on Codeplex in the near future.
  • The server infrastructure (Dublin) to host and manage these new types of applications will become available after .NET 4 and Visual Studio 2010 ship.

Links:

Monday, September 29, 2008

Visual Studio 2010/.NET 4.0 Roundup

Today Microsoft announced that, although recently referred to as Visual Studio 10 or "Hawaii", the official name of the next release will be Visual Studio 2010 and it will be accompanied by .NET Framework 4.0.

eWeek reports:

Microsoft announces Visual Studio 2010 and .NET Framework 4.0, and says the overall development strategy revolves around five pillars. The first pillar involves the Visual Studio Team System (VSTS) 2010, formerly codenamed “Rosario.”

Microsoft has announced the name of the next version of its developer tools and platform: Visual Studio 2010 and the .NET Framework 4.0.

In the announcement on Sept. 29, Microsoft also described the next release through the following five focus areas: riding the next-generation platform wave, inspiring developer delight, powering breakthrough departmental applications, enabling emerging trends such as cloud computing, and democratizing ALM (application life-cycle management), said Dave Mendlen, a director of product management in Microsoft’s Developer Division.

However, Mendlen did not give an actual date for when the new technology would become available, except to say that its name implies something about the time frame of its availability.

http://www.eweek.com/c/a/Application-Development/Microsoft-Announces-Visual-Studio-2010-and-NET-Framework-40/

From InformationWeek:

In Visual Studio 2010, Microsoft also will introduce a feature it likens to an airplane's black box. While running a test of an application, a "black box" records the state of the machine and the application. That way, a tester can look at a debug log running alongside a video replay of the application that was under test and dive into all layers of the computing stack to see where a bug might have occurred.

Visual Studio Team System 2010 will include some pieces of Microsoft's "Oslo" modeling strategy, as first demonstrated at Microsoft's TechEd conference earlier this year. The Architecture Explorer will allow architects and developers to build, customize, and see an architectural diagram of an application and enforce architectural consistency on builds of a piece of software. The software will support the Object Management Group's Unified Modeling Language and domain-specific languages.

 

More screenshots from Martin Heller at InfoWorld (click to enlarge):

 

 

More links:

Videos from Microsoft.

Mary-Jo Foley's blog

SD Times

Silverlight 2 Release Candidate Now Available

Scott Guthrie announces.

There are some breaking changes between Beta2 and this RC, and we want to make sure that existing sites can update to the final release quickly once the final release is out.  As such, you can only use the RC for development right now - you can't go live with the new APIs until the final release is shipped (which will be soon though).

You can download today's Silverlight Release Candidate and accompanying VS and Blend support for it here.  Note that Expression Blend support for Silverlight 2 is now provided using Blend 2.0 SP1.  You will need to install Blend 2.0 before applying the SP1 service pack that adds Silverlight 2 support.  If you don't already have Blend 2.0 installed you can download a free trial of it here.

The final release of Silverlight is not that far off now.  It has been a pretty amazing project that has come a long way in a pretty short amount of time.

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.

Monday, August 25, 2008

NHibernate 2.0 has been released

NHibernate is a port of the Java Hibernate ORM (Object-Relational Mapper) and has the feature set of Hibernate 3.2.

If you are looking for docs or tutorials, try Fabio's wiki: http://knol.google.com/k/fabio-maulo/-/1nr4enxv3dpeq/21 

Download here: SourceForge.net: Files