Web Application Toolkits

 

Web App Toolkits that show you how to accomplish common web development tasks with small sample apps.  The scenarios covered with the first round of Web App Toolkits include:

Via Web Application Toolkits | LostInTangent | Channel 9

Unity IoC in 30 seconds

Object Factory

Container-Configured Registration of Types

As an example of using the overloads of the RegisterType and Resolve methods, the following code registers a mapping for an interface named IMyService, and specifies that the container should return an instance of the CustomerService class (which implements the IMyService interface).

IUnityContainer myContainer = new UnityContainer();
myContainer.RegisterType<ILoggingService, LoggingService>();
ILoggingService myServiceInstance = myContainer.Resolve<ILoggingService>();

Container-Configured Registration of Existing Object Instances

As an example of using the overloads of the RegisterInstance and Resolve methods, the following code registers an existing instance of a class named LoggingService that implements the interface IMyService and then retrieves that instance.

IUnityContainer myContainer = new UnityContainer();
LoggingService myExistingObject = new LoggingService();
myContainer.RegisterInstance<ILoggingService>(myExistingObject);
ILoggingService myServiceInstance = myContainer.Resolve<ILoggingService>();

Constructor Injection

As an example of constructor injection, if a class that developers instantiate using the Resolve method of the Unity container has a constructor that defines one or more dependencies on other classes, the Unity container will automatically create the dependent object instance specified in parameters of the constructor. For example, the following code shows a class named CustomerService that has a dependency on a class named ILoggingService.

public class CustomerService
{
  public CustomerService(ILoggingService myServiceInstance)
  {
    // work with the dependent instance
    myServiceInstance.WriteToLog("SomeValue");
  }
}

Property (Setter) Injection

In addition to constructor injection, described earlier, the Unity Application Block supports property and method call injection. The following code demonstrates property injection. A class named ProductService exposes as a property a reference to an instance of another class named SupplierData (not defined in the following code). To force dependency injection of the dependent object, developers must apply the Dependency attribute to the property declaration, as shown in the following code.

public class ProductService
{
  private ISupplierData supplier;

  [Dependency]
  public ISupplierData SupplierDetails
  {
    get { return supplier; }
    set { supplier = value; }
  }
}

Highlights of the Unity Application Block


The Unity Application Block includes the following features:

  • It provides a mechanism for building (or assembling) instances of objects, which may contain other dependent object instances.
  • It exposes RegisterType methods that support configuring the container with type mappings and objects (including singleton instances) and Resolve methods that return instances of built objects that can contain any dependent objects.
  • It provides inversion of control (IoC) functionality by allowing injection of preconfigured objects into classes built by the application block. Developers can specify an interface or class type in the constructor (constructor injection), or apply attributes to properties and methods to initiate property injection and method call injection.
  • It supports a hierarchy for containers. A container may have child container(s), allowing object location queries to pass from the child out through the parent container(s).
  • It can read configuration information from standard configuration systems, such as XML files, and use it to configure the container.
  • It makes no demands on the object class definition. There is no requirement to apply attributes to classes (except when using property or method call injection), and there are no limitations on the class declaration.
  • It supports custom container extensions that developers can implement; for example, methods to allow additional object construction and container features such as caching.

Via Introduction to Unity

XAML Power Toys

 

XAML Power Toys

Table Of Contents


Introduction

XAML Power Toys is a Visual Studio 2008 SP1 Add-In that empowers WPF & Silverlight developers while working in the XAML editor.  Its Line of Business form generation tools, Grid tools,  DataForm, DataGrid and ListView generation really shorten the XAML page layout time.

I’m begging every developer in the strongest possible terms, please view the below videos. They will get you up and running and productive in a very short time.

Group Into (7:28 )
Create Business Form (5:19)

Grid Tools (Remove Margins, Chainsaw) (5:22)
Fields List (4:16) New

Edit Grid Row Columns (7:22)
Create ViewModel fromm Class (15:03) New

Extract Properties to Style (3:30) New
Create Form, DataForm, DataGrid, ListView (13:30) New

Control Default Settings (8:16) New

Via XAML Power Toys « Karl On WPF – .Net

Integrating OpenID / OAuth in an ASP.NET MVC Application using DotNetOpenAuth

 

image

How to implement OpenId for authentication rather than the custom username/password login that’s been in use up until now. OpenId is a centralized login/authentication mechanism which handles authentication through one or more centralized OpenId providers. These providers live on the Web and are accessed through a forwarding and callback mechanism – you log in at the provider’s site and are then returned to the original starting Url with an authorized user token that uniquely identifies that user to the original site.

Via Integrating OpenID in an ASP.NET MVC Application using DotNetOpenAuth – Rick Strahl’s Web Log

Silverlight Wiki-OS

 

Wiki-OS is the only open-source web OS (online operating system) where anyone can contribute right away like a wiki. It lets you:
  • Launch applications without installation (in a secure sandbox)

  • Share applications by embedding them into web pages

  • Develop Silverlight and .NET applications right from the browser

  • Allow others to enhance and maintain your application, the wiki way

Watch the 40-second video overview

Access your applications and data from any computer

Wiki-OS simulates an operating system inside your web browser. It lets you to launch rich-client applications without installation and access your data from any computer connected to the Internet. Applications are executed in a sandbox that securely isolates them from the rest, so that your computer is always protected.

Screenshot

Embed applications on your website or blog.

Similarly to how you can put a YouTube video on a website or blog, you can put a Wiki-OS application inside any web page. Just click the "embed" button at the top-right corner of any application and copy/paste the code snippet.

Via What is Wiki-OS? / FAQ

Microsoft Ajax CDN and the jQuery Validation Library

Scott Guthrie announced the launch of the Microsoft Ajax CDN on his blog last night. If you have not read his post, I recommend that you read it now to get a general overview of the CDN and how you can take advantage of the CDN to improve the performance of your ASP.NET Web Forms and ASP.NET MVC applications:

http://weblogs.asp.net/scottgu/archive/2009/09/15/announcing-the-microsoft-ajax-cdn.aspx

“The Microsoft Ajax CDN enables you to significantly improve the performance of ASP.NET Web Forms and ASP.NET MVC applications that use ASP.NET AJAX or jQuery.  The service is available for free, does not require any registration, and can be used for both commercial and non-commercial purposes.

ASP.NET 4.0 will make it especially easy for ASP.NET Web Forms developers to take advantage of the CDN. By setting one property of the ScriptManager control – EnableCdn=true, you will be able to redirect all requests for the built-in ASP.NET JavaScript files to the CDN and improve the performance of your Web Forms applications.”

In his announcement, Scott describes how both the ASP.NET Ajax and the jQuery libraries are included in the CDN. There is one more set of JavaScript files that are added to the CDN today that Scott did not announce: the jQuery Validation library.

If you are not familiar with the jQuery Validation library then you should know that this is one of the most popular form validation libraries used by jQuery developers. Microsoft is shipping the jQuery validation library with both ASP.NET Web Forms and ASP.NET MVC in Visual Studio 2010.  Furthermore, jQuery Validation library will be integrated with ASP.NET MVC.

Via Microsoft Ajax CDN and the jQuery Validation Library