Saturday, July 3, 2010

Movie Star

type="application/x-shockwave-flash">



Saturday, October 24, 2009

Output your SQL when using Linq in ASP.NET

image

I used both Linq Data Source and straight Linq.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
StringWriter sw = new StringWriter();
protected void Page_Load()
{
// Using Linq Data Source
LinqDataSource1.ContextCreated += (sender, e) =>
{
sw.WriteLine("Grid 1 SQL");
((DataClassesDataContext)e.Result).Log = sw;
};

// Using Linq
DataClassesDataContext db = new DataClassesDataContext();

var results = from c in db.Customers
where c.City == "London"
select c;

GridView2.DataSource = results;

sw.WriteLine("Grid 2 SQL");
db.Log = sw;
GridView2.DataBind();

}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
writer.Write("<hr><p>LINQ to SQL Trace Console</p><p><textarea cols='100' rows='15' readonly='true'>");
writer.Write(sw.ToString());
writer.Write("</textarea></p>");
}

}

Wednesday, October 14, 2009

Disk2vhd v1.0

http://technet.microsoft.com/en-nz/sysinternals/ee656415(en-us).aspx

Disk2vhd will create a vhd out of your hard drive.

image

Tuesday, October 13, 2009

Generate your own custom Controller and Views by overriding the default MVC T4 templates

Create a ASP.NET MVC Web Application

image

image

image

Copy the CodeTemplates directory into the root of your MVC project.

By copying this directory into your root directory you will be overriding the default templates.

The CodeTemplates directory can be found here:

C#

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Web\MVC

or

VB.NET

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\VisualBasic\Web\MVC

image

Highlight each t4 template and delete the “Custom Tool” properties.

image image

Modify template(s)

image

Add new controller

image

image

Now you can see your custom created controller!!!

(This applies to the views as well)

image