Microsoft Study Bible

November 3, 2009

SQLAzureMW: Migrate SQL 2005/ 2008 to SQL Azure

SQL Azure Migration Wizard (SQLAzureMW) is a project on the CodePlex, which helps you migrate to your local SQL Server 2005 / 2008 databases into SQL Azure.

 The SQL Azure Migration Wizard (SQLAzureMW) will let you identify a SQL Server 2005 / 2008 database that you want to migrate to SQL Azure or select an existing SQL file that has the commands you want to execute against SQL Azure. After you choose SQL Server 2005/2008 database, SQLAzureMW walks you through the selection of your SQL objects, creates SQL scripts suitable for SQL Azure, and allows you to edit / deploy to SQL Azure.

If your source is a SQL Server database, SQLAzureMW will walk you through the different object types (i.e. Tables, Stored Procedures, Views, etc.) and let you decide which ones you want analyzed / scripted. You will be given three options:

 Script to window - Choose this option to display the SQL script to a wizard window where you can modify it before telling the wizard to script to Azure. 

  Script to file - Choose this option if you want to save your SQL script to a file. You can edit this file in SQL Server Management Studio and run it from there or save it and use the wizard to load and run your file.

Scrip to Azure—Choose this option if you have database compatible with SQL Azure. It will prompt you to input Azure account and then run the generated script.

SQLAzureMW can handle the incompatibility between SQL 2005/2008 and SQL Azure. For example, it will l automatically try to make changes to your SQL Azure tables / stored procs / view (for example, text columns will become varchar (max) columns), and unbind XML schema collections, which SQL Azure don’t support .These conversions and changes of script are stored in a XML configuration file named NotSupportedByAzureFile.config.

  The current version of SQLAzureMW in Alpha v0.2 is based on Microsoft Public License Ms-PL)。SQLAzureMW is a project in VS 2008, which must run on .NET 3.5.

           

 

October 26, 2009

What does ASP.NET 3.5 Extensions bring to us?

Filed under: Developer tools and applications — Tags: , , , , — Jackson @ 9:32 pm

1. Overview

The release of the new technology .NET 3.5 and Visual Studio 2008 makes milestone contribution to the .NET strategy of Microsoft. In the Web development, it includes a powerful HTML Web designer which provides split-view editing, and the perfect CSS. Meanwhile, it makes its support to JavaScript better, including Intelligent hints and debug.

 

Microsoft issued the first preview version of ASP.NET 3.5 Extensions only 20 days after it released .NET 3.5. The final version is released in the first half of the year 2008, which contains more features of ASP.NET:

1. ASP.NET MVC Framework

2. Improvement of ASP.NET AJAX

3. ASP.NET Dynamic Data support 

4. ASP.NET Silverlight support

5. ADO.NET Data services

 

In this article, I will display some of the new features of ASP.NET 3.5 Extensions though several simple examples.

2. ASP.NET MVC framework

The concept of MVC has been raised for many years. It divides the application implementation into three parts: Model to maintain the data status, View to display the user interface, Controller to handle the user interaction, operate Model and select View to display the data. The first concern of ASP.NET MVC Framework is separation for testing more conveniently. Meanwhile, it uses aspx page, template page and user control as View and provides powerful URL Routing Engine. I will show these features by examples.

 

Step1: set up Model, use LINQ to SQL to establish a Product data model

 

 

 

Step2 set up View, display the detailed information of Pdoduct by using an aspx page which inherited from a Generic ViewPage

 

public partial class Product_Product : ViewPage<ProductInfo>
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
 

 

 

 

   show the data in aspx page, use <%=%> directly to label output 

<div>
<h2>ProductDetail:</h2>
ProductId

<%= ViewData.ProductId %><br /><br />
Name
<%= ViewData.Name %><br /><br />
Descn
<%= ViewData.Descn %>
</div>
 
 

 

 

Step3set up Controllerinherit from Controller base classand add Actionat the same time, use product view to realize the data function and input data object that needs to be displayed.

public class ProductController : Controller
{
[ControllerAction]
public void Index()
{
MSPetShopDataContext db = new MSPetShopDataContext();
ProductInfo productinfo = db.ProductInfos.Single(p => p.ProductId == “BD-03″);
RenderView(”Product”, productinfo);
}
}
 

 

 

 

Step4select Path for Configurationmake configurations Application_Start

 

void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Add(
new Route
{
Url = “[controller]/[action].mvc”,
Defaults = new { action = “Index”},
RouteHandler = typeof(MvcRouteHandler)
}
);
}
 
 

 

basicly, the proceedings are the four steps for setting up a application based on ASP.NET MVC Framework.

   


3. ASP.NET AJAX improvement
 
 

 

In the ASP.NET 3.5 Extensions, the most important improvement to ASP.NET AJAX is a better support to browser history that we can control the Back and Forward button more conveniently. It provides two ways for us to choose, using server-side control or Client-script. In the following, I will illustrate how to use server-side control to control the browser history.


       add ScriptManager Control
and set its EnableHistory attribute as truepermit the history management of browser and OnNavigate handled as OnNavigateHistory function for dealing with navigation event. At the same time, set the EnableStateHash attribute as false to make modifications easier to perform. In real situations, we can decide whether to perform the Hash encryption as required:

 

<asp:ScriptManager runat=”server” ID=”ScriptManager1″
OnNavigate=”OnNavigateHistory”
EnableHistory=”true”
EnableStateHash=”false” />

 

Create Browser history point at the time of clicking button with the way of AddHistoryPoint

 

 

public void ButtonClick(object sender, EventArgs e)
{
LabelHistoryData.Text = ((Button)sender).Text;
ScriptManager.GetCurrent(this).AddHistoryPoint(key, LabelHistoryData.Text);
} 

 

Navigation processing

public void OnNavigateHistory(object sender, HistoryEventArgs e)
{
LabelHistoryData.Text = Server.HtmlEncode(e.State[key]);
} 

 

For demonstrationthree button should be added on the page

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Button3" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Panel runat="server" CssClass="box" ID="Content" Height="40px">
Date and Time:
<%= DateTime.Now.ToLongTimeString() %>
<br />
Page's refresh state:
<asp:Label runat="server" ID="LabelHistoryData" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<p />
<asp:Button runat="server" ID="Button1" Text="Key 1" OnClick="ButtonClick" />
<asp:Button runat="server" ID="Button2" Text="Key 2" OnClick="ButtonClick" />
<asp:Button runat="server" ID="Button3" Text="Key 3" OnClick="ButtonClick" /> 

 

  

In the preceding, I mainly use the server-side approach to realize the support to browser history in ASP.NET AJAX, you can also use client script to manage browser history.

 

 

 

 

 

 

Powered by WordPress

Close
E-mail It