Learning Curve…

Archive for April 2012

 

ASP.NET 4.0 supports built in support for URL Routing. This can make site more user friendly and site content more discoverable by search engines. It is also easy to remember and while bookmarking.

Following example shows URL without using Routing mechanism of ASP.NET 4.0.

http://website/products.aspx?categoryid=12

After using Routing mechanism of ASP.NET 4.0, above URL becomes as follow.

http://website/products/software

For mapping above URL to the list of products based on category, we need to map our route using new method MapPageRoute of class Route as shown in following examples.
Application_Start(object sender, EventArgs e)   {
     RouteTable.Routes.MapPageRoute(“ProductsRoute”,
         “product/{prodId}”, “~/products.aspx”);
}

 

  1. Range variable: – A variable defined in your LINQ query that is subsequently used in the select and where parts.
  2. Strong typing: – A programming concept where the type of a variable is explicitly defined when the variable is declared.
  3. Type inference: – A technique where the compiler determines the type of a variable based on the data it gets assigned. This enables you to create strongly typed variables without explicitly defining the variable’s type first
  4. Lazy loading: – A technique where data is not loaded from the database until it is accessed at runtime.
  5. Anonymous types:-Types that are created on-the-fly without defining them explicitly.

The script to check if column exists and then renaming the column:-

IF EXISTS (SELECT * FROM sys.columns WHERE Name = N’OldColumnName’ AND Object_ID = Object_ID(N’TableName’))
BEGIN
   EXEC sp_RENAME ‘TableName.OldColumnName’ , ‘NewColumnName’, ‘COLUMN’
END


Author

Learning days (Calendar)

April 2012
M T W T F S S
« Mar   Jun »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Knowledge Bank (Archives)

I am on Twitter

Blog Stats

  • 498,681 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 43 other followers

%d bloggers like this: