Wriju's BLOG

.NET, Cloud and everything

Windows Azure : Monitoring Storage Using Visual Studio Server Explorer

Using Visual Studio 2010 Server Explorer you can manage the Windows Azure Storage and Hosted Services. By default the development storage is added. If you want to add the live storage you can add them by selecting that node and right clicking After that Then add the required information. Namoskar!!!… Read more

Visual Studio Virtual Lab Arsenal

Visual Studio Team Foundation Server 2010 MSDN Virtual Lab: TFS Training Kit: Module 1 MSDN Virtual Lab: TFS Training Kit: Module 2 MSDN Virtual Lab: TFS Training Kit: Module 3 Microsoft Visual Studio LightSwitch 2011 Virtual Labs MSDN Virtual Lab: Visual Studio LightSwitch 2011: Bookstore MSDN Virtual Lab: Visual Studio LightSwitch 2011: Enhancing Bookstore MSDN… Read more

Visual Studio 2010 Training Kit for SP1

You can download it today by going here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=752CB725-969B-4732-A383-ED5740F02E93&displaylang=en Silverlight 4 ·         Hands-on Lab – Migrating a Windows Forms Application to Silverlight ·         Hands-on Lab – Migrating an ASP.NET Web Forms Application to Silverlight ·         Hands-on Lab – Working with Panels, XAML and Controls ·         Hands-on Lab – Silverlight Data Binding ·         Hands-on Lab –… Read more

Visual Studio 2010 SP1 : What’s there

I am very excited to see the Visual Studio 2010 SP1. You can download this from http://go.microsoft.com/fwlink/?LinkId=209902. The article http://go.microsoft.com/fwlink/?LinkId=209902 talks about what is there and some of my picks are   HTML5 and CSS3 designer support Razor support IntelliTrace support for x64 And a lot of open issues have been resolved too. Namoskar!!!… Read more

Visual Studio 2010 Keyboard Bindings

All the Visual Studio 2010 Keyboard bindings are available here for you to download. These are very helpful resources for a person who spends most of his days in Visual Studio. Go and grab it from http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=92ced922-d505-457a-8c9c-84036160639f  I personally like Ctrl+. which allows me to add the using statement without going to the top of… Read more

Installing TFS 2010 is very very Easy

Installing Team Foundation Server 2010 is as easy as Microsoft Office Installation. This is my second attempt to install single server TFS 2010. I am successful again. Few things we need to take care is 1. Use the Team Foundation Server 2010 Installation Guide and follow it step by step at http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2d531219-2c39-4c69-88ef-f5ae6ac18c9f&displaylang=en 2. I had… Read more

Visual Studio 2010 Working Offline

Today I found one interesting stuff while I was away from corpnet and changing the source code. It was asking me to override while saving the file. I did it as because I had done some work there. Later when I was connected to the corpnet I right clicked and selected the option “Go Online”…. Read more

LINQ : From Basics to Query

Many of us are aware of LINQ today. LINQ is an amazing programming language feature. During my discussions I find a lot of myths around understanding. Here I have tried to demonstrate from some basics of C# 3.0 language enhancements to delegate, anonymous type, lambda expression and finally LINQ. How it has evolved. https://channel9.msdn.com/posts/LINQ-Evaluation-From-Basics-to-Implementation Namoskar!!!… Read more

Entity Framework finding the differences between production database and model’s schema

We develop our ADO.NET EF model from the development environment db and then when finally run it to the production we might find that DBA might have added few rules or renamed the database columns. Then our application would start throwing errors. One easy way to get it rectified is to run query against each… Read more

Generate Dummy Test Data using Data Generation Plan

Most of the time we struggle to get some dummy data for various types of testing. Data Generation Plan in Visual Studio 2010 helps to achieve it. It not only fills the tables based on the number of rows selected by us it also takes care of the relationship if any. One thing to remember… Read more

Comparing Two SQL Server Schema using Visual Studio 2010

When you have two SQL Sever Databases and need to find the differences, Visual Studio comes really handy. Under Visual Studio 2010’s menu Data > Schema Compare. Once you choose New Schema Comparison   Then you choose your databases. After you choose it you can also set the Schema Compare Settings. Once you press OK…. Read more

Free Web Camps Training Kit

Do you want to learn Web Technologies? ASP.NET MVC 2, ASP.NET 4 Web Forms, jQuery, Entity Framework using Visual Studio 2010 with lots of Demos, Hands-On-Labs and scenario based content. Download and start using today from http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=0a906559-28bd-4f5d-ac18-f895a200a2a5 Namoskar!!!… Read more

Visual Studio 2010 Tip : Set multiple project as startup

This is not new in Visual Studio 2010. However this could be helpful while creating WCF based application. You may like to test your application from Visual Studio 2010 by hitting F5. By default, we can make only one project as Startup Project.  Select the solution and right click and select Namoskar!!!… Read more

EF4 : How to enable Model without code

When we need to work with an Entity Framework model and use POCO. We need to get rid of the designer generated code. But how? There are few ways by which we can achieve it. Option 1 I personally like this approach. You need to open the Model designer and click F4. The change the… Read more

EF4 : Complex Type

Is to simplify your life which might seem too complex :). Let’s suppose you have a table like, Now you might want to club all address related field and make one single representation to it. Once you have created the model in your Visual Studio 2010, you may just need to select all the properties… Read more

EF4: What’s in it there in Foreign Key

There are a lot of buzz around the Foreign Key support in ADO.NET Entity Framework v4. Question often comes to our mind that what is so special here? While discussing with my fellow Consultant Vijay, he gave me a nice example. Let me share here, Let’s assume that you have two tables Dept and EmpDept…. Read more

EF4 : Use MergeOption.NoTracking for better query performance

If you are just trying to fetch the data and has no intention to update it. Then you should be using the MergeOption.NoTracking to ensure that the ObjectStateManager does not store the required information for update and delete. Hence your query would be more quick in nature. using (NorthwindEntities ctx = new NorthwindEntities()) {     ctx.Customers.MergeOption… Read more

ADO.NET Entity Framework 4.0: Making it fast through Compiled Query

If we are using similar query frequently, we can increase it’s performance by Compiling it through CompiledQuery. It’s always recommended to use CompiledQuery if you happen to see the query is getting executed many times. Let’s take an example, in Northwind database if you are getting Customer based on City. You may follow the below… Read more

ADO.NET Entity Framework 4.0: Simple N-Tier with Self-Tracking Entities and WCF

ADO.NET Entity Framework 4.0 allows us to easily create N-Tier Application with the help of Self-Tracking Entities. This means now we do not have to worry about merging and checking values in more disconnected scenario. Here is how we can do it in very simple example to start with. Create Model Layer ·         Create a… Read more

ADO.NET Entity Framework 4.0 : Loading Data in 4 ways

  We are working with Relational Database and using ADO.NET Entity Framework 4.0, it is inevitable that we need to load data. EF4 has improved Lazy Loading feature as compared to its previous version. We can also combine both Lazy and Eager loading.   Based on the amount of data we bring in and type… Read more

ADO.NET Entity Framework 4.0 : POCO – The Code Only Approach

POCO in ADO.NET Entity Framework 4.0 has been discussed in many places. Here I am not going to talk about it. However, I created a small sample to demonstrate the capability of POCO in much more cleaner “code-only” approach. <<Apology for this blog post issue>>. There were some images, due to which it was not… Read more

LINQ to SQL : Windows Forms Dynamic Where Clause

While I was reading the book LINQ in Action, I found this chapter. Below is how we can do in LINQ to SQL. The scenario is if you want to create a LINQ and pass the where clause based on user input from UI, you need to write different queries. Instead, how you can do… Read more

Visual Studio 2010 : Dependency Graph, Sequence Diagram and Architecture Explorer

I generally avoid meta blogging, but while going through my MSDN RSS feed I found one very detailed article on few of my favorite Visual Studio 2010 Features at http://blogs.msdn.com/jennifer/archive/2010/05/11/visual-studio-2010-how-to-understand-your-code-using-dependency-graphs-sequence-diagrams-and-the-architecture-explorer.aspx It’s a good read indeed. Namoskar!!!… Read more

Silverlight 4 Training Kit is available

Just released a new free Silverlight 4 Training Kit that walks you through building business applications with Silverlight 4. You can also download the entire offline version of the kit here.  You can use the 8 modules, 25 videos, and several hands on labs online or offline from links on the Channel 9 site. Module… Read more

.NET Framework 4.0 Newbie : File.ReadLines

In .NET Framework 4.0 instead of you using File.ReadAllLines() use ReadLines() to get a better performance. Question is why? File.ReadLines() uses IEnumerable to get the lines. Unlike File.ReadAllLines() it does not first read full files and the starts reading if you have implemented the iteration. Also File.ReadAllLines() does not implement MoveNext().   But there is… Read more

.NET Framework 4.0 Newbie : String.IsNullOrWhiteSpace

In .NET Framework 4.0 we have String.IsNullOrWhiteSpace. String sData = ” “;   if (String.IsNullOrWhiteSpace(sData)) {     Console.WriteLine(“Nothing to do”); }   This would help us to determine whether to work with a string without calling additional Trim() method. Namoskar!!!… Read more

.NET Framework 4.0 Newbie : Addition to Environment.SpecialFolder enum

In .NET Framework 4.0 we have few new useful Environment variables, AdminTools CDBurning CommonAdminTools CommonDesktopDirectory CommonDocuments CommonMusic CommonOemLinks CommonPictures CommonProgramFilesX86 CommonPrograms CommonStartMenu CommonStartup CommonTemplates CommonVideos Fonts LocalizedResources MyVideos NetworkShortcuts PrinterShortcuts ProgramFilesX86 Resources SystemX86 UserProfile Windows In addition to that Environment.GetFolder path now has one additional overload which accepts Environment.SpecialFolder enum as parameter. These address a… Read more

.NET Framework 4.0 Newbie : SortedSet<T>

In .NET Framework 4.0 we have a new class called SortedSet<T>. This helps us to sort the elements without explicitly we implementing any sort method. var sSet = new SortedSet<int> { 2, 4, 6, 8, 9, 1, 3, 5, 7 };   //Getting directly the sorted output foreach (int iVal in sSet) {     Console.WriteLine(iVal);… Read more

.NET Framework 4.0 Newbie : StringBuilder.New

In .NET Framework 4.0 we have an option to clear StringBuilder class. Unlike previous versions where we used to write StringBuilder.Length = 0 to clean, now we can implement a new method called Clear().   var sBulder = new StringBuilder();   sBulder.Append(“Anyhting”); sBulder.Append(“Again another”);   //Previous approach to clear up StringBuilder sBulder.Length = 0;  … Read more

.NET Framework 4.0 : Obsolete Types and Members

There are a few obsolete types and members in .NET Framework 4.0. This is an extensive reference for those who write code. Obsolete Types in .NET Framework 4.0 http://msdn.microsoft.com/en-us/library/ee461503(VS.100).aspx Obsolete Members in .NET Framework 4.0 http://msdn.microsoft.com/en-us/library/ee471421(VS.100).aspx Namoskar!!!… Read more

My First Channel 9 Video on Visual Studio 2010 IDE Tips

I am super excited to share with you my First video at Channel 9. Today I have successfully published it. This small video covers few basic IDE tips of Visual Studio 2010.   https://channel9.msdn.com/posts/wriju/Visual-Studio-2010-IDE-Settings-Tips-and-Tricks/   Namoskar!!!… Read more

Visual Studio 2010 Tips #7 : Dependency Graph

  In Visual Studio 2010 you can now create the dependency graph to view the complex structure of your class and the call tree.       Once you explore it has got some additional view like, Right to Left. If you click on any entity it will take you to the code.    … Read more

VS 2010 Tips#6 : Architecture Explorer

In Visual Studio 2010 we have a great tool called Architecture Explorer to view the structure of our objects. Unlike object browser or class diagram this also helps us to view the calls per element is made in the project. This is one additional step towards the enhancement. This can be found at Namoskar!!!… Read more

VS 2010 Tips #5 : New Extension Manager

In Visual Studio 2010 we can now get all the available extensions from http://visualstudiogallery.msdn.microsoft.com and add to our project from and within Visual Studio. You will find it under Tools > Extension Manager. Here you can add, search and modify the available extensions. Namoskar!!!… Read more

VS 2010 Tip #2 : Close Start Page after Project Load

Now in Visual Studio 2010 you can close the start page after it loads the project you select from Recent Project list. There is a check box at the bottom left which helps you to decide whether you want to close the Start page or keep it open. Namoskar!!!  … Read more

VS 2010 Tip #1 : Recent Projects > Start Page

As Visual Studio 2010 is built using WPF, the new enhanced start page also has some additional features. Recent Projects Now you can control the Recent Project List by Pin-UnPin the projects from existing list Removing unnecessary projects from the list and also can open the “Containing Folder”   Namoskar!!!… Read more


LINQ can be more faster with the availability of multi-core desktops. This can be implemented with minimal impact at the code level with existing code. Here how it looks like, Dim arrInt = Enumerable.Range(1, 4000000) Dim q =     From n In arrant     Where (IsPrime(n))     Select n In my dual core machine it… Read more

VB.NET 10 : Working with Array

Working with Array in VB.NET 2010 (VS 2010) is real fun. You can leave it to the compiler to decide. Be it one dimensional array, two dimensional array or jagged array.. One-dimensional Array When you declare something Dim arr() As Integer = New Integer() {1, 2, 3, 4} You explicitly mention the type so on…. Read more

Patterns for Parallel Programming

WOW!!! When I first saw it.   Patterns for Parallel Programming: Understanding and Applying Parallel Patterns with the .NET Framework 4   http://www.microsoft.com/downloads/details.aspx?FamilyID=86b3d32b-ad26-4bb8-a3ae-c1637026c3ee&displaylang=en   You must must read it!!!   Namoskar!!!  … Read more

VB.NET 10 : Optional Nullable Parameter

If you want to assign Nothing to the optional parameter in VB.NET 10, it is just like to obvious now, Sub Main()     ‘Passing value for the optional parament _age     MyFunc(“Wriju”, “wriju@contoso.com”, 30)       ‘No value is supplied for the optional parament _age     MyFunc(“Writam”, “writam@contoso.com”) End Sub     Sub MyFunc(ByVal _name… Read more

VB.NET 10 : Multiline Lambdas

With implicit line continuation VB.NET 10 now allows you to write the multiline Lambdas. That means like your normal Functions you can write functions under Lambdas. So now you may write like, Dim arrInt As Integer() = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}   Dim myFinc = Array.FindAll(arrInt, Function(n)                                        If… Read more

Parallel Computing: PLINQ

Visual Studio 2010 has new API for LINQ (Language Integrated Query). This helps us to implement the power of Parallel Computing in declarative manner. LINQ without Parallel Extension It will take 3 sec for 28 thousand elements. static void Main(string[] args) {     Stopwatch sw = Stopwatch.StartNew();         DoIt();       Console.WriteLine(“Elapsed = “… Read more

Parallel Computing: The new “Task” API

Visual Studio 2010 has new API called “Task”. This helps us to create small pieces of work and execute in distributed manner under multi core machine. Unlike thread it has flexibility to adopt the lower number of CPU without changing code. With improved CLR thread pool local processes are not confined in local thread pool… Read more

Visual Studio 2010 Beta 2

I have installed the Beta 2 of Visual Studio 2010. I love its splash screen Go get it and enjoy!!! Find more information at http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx MSDN Subscribers: Download the Beta The Visual Studio 2010 and .NET Framework Beta 2 is available to MSDN subscribers on Monday, October 19th, with general availability on October 21st. How… Read more

VB.NET 10 : Nullable Optional Parameter

You can create method with optional parameter and also make them Nullable. Optional with default value Sub Test(ByVal _name As String, ByVal _email As String, Optional ByVal _age As Integer = 30)   Optional and Nullable Sub Test(ByVal _name As String, ByVal _email As String, Optional ByVal _age As Integer? = Nothing) Similarly you also… Read more

VB.NET 10 : Collection Initializer

Another useful feature which was missing in VB.Net 9 is available in Visual Studio 2010. This provides option to declare and initialize with series of values with the keyword Form. Dim myList As New List(Of Integer) From {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}   For Each i In myList     Console.WriteLine(i)… Read more

What’s new in ASP.NET 4.0 and Visual Studio Beta 2?

List is quite big!!!   Core Services    Web.config File Minification    Extensible Output Caching    Auto-Start Web Applications    Permanently Redirecting a Page    The Incredible Shrinking Session State    Expanding the Range of Allowable URLs    Extensible Request Validation    Object Caching and Object Caching Extensibility    Extensible HTML, URL, and HTTP Header… Read more

Parallel Computing: Leverage the better hardware tomorrow

It has quite a sometime we have been using .NET with System.Threading namespace. So what is new there in Parallel Computing in .NET Framework 4.0 with Visual Studio 2010. There are a lot   Ø  Task-based fine grained parallelism Ø  Better debugger feature Ø  Structured Parallelism Ø  Declarative Parallelism   Above all you are getting… Read more

C# 4.0 and Parallel Programming Resources

C# 4.0   The Future of C# by Anders Hejlsberg at PDC 2008 https://channel9.msdn.com/pdc2008/TL16/   Slide Deck http://mschnlnine.vo.llnwd.net/d1/pdc08/PPTX/TL16.pptx   Sample Code and Whitepapers http://code.msdn.microsoft.com/csharpfuture/   C# 4.0, Dynamic Programming and JSON http://www.nikhilk.net/CSharp-Dynamic-Programming-JSON.aspx   Easy to understand Co- and Contra Varinace http://blogs.msdn.com/charlie/archive/2008/10/28/linq-farm-covariance-and-contravariance-in-visual-studio-2010.aspx   Parallel Programming   PDC 2008 Session by Daniel Moth   Parallel Programming for… Read more

C# 4.0 : Co-variance and Contra-variance

Here I am going to talk about the feature called Covariance and Contravariance. To show you the example I will use delegate. Now what is it? This would be a big question and with no hesitance I must say that you should visit Eric’s blog. There are some articles which will help you understand. To… Read more

Visual Basic 10 : Line Continuation Magic

There are some new enhancements in Visual Basic 2010 or Visual Basic 10 where you can really have greater flexibility on how you handle multiple lines for continuous statements,   ‘Explicit Continious Line (no need to use & _ ) Dim sContinuation As String =     “Hey you know I can write multiple lines without… Read more

Visual Studio 2010 : Multi Targeting

Like Visual Studio 2008, in Visual Studio 2010 also we have multi-target. So ideally you can create project targeting Framework 2.0, 3.0, 3.5 and 4.0. This behaviour is little different here. Earlier, we have Framework 3,5 carrying both 2.0 and 3.0. So in Visual Studio 2008 it was just the intellisense alter and control load… Read more

ADO.NET Entity Framework v2 : ExecuteStoreQuery

There is now an option in ADO.Net Entity Framework v2 for us to execute store query,   IEnumerable<Customer> custs =  ctx.ExecuteStoreQuery<Customer>(“SELECT * FROM Customers”, null);   foreach (var c in custs) {     Console.WriteLine(c.CustomerID);     }   Namoskar!!!  … Read more

Visual Studio 2010 and .NET Framework 4 Beta 1 Walkthroughs

Watch out the videos on Visual Studio 2010 at http://msdn.microsoft.com/en-us/teamsystem/dd441784.aspx Here are some of them, Ø  Dynamic Programming in Visual C# and Visual Basic   Ø  Office Programmability in Visual C# and VisualBasic   Ø  Test-driven Development with Generate From Usage   Ø  F# in Visual Studio 2010   Ø  Deploying Multiple Office Solutions in… Read more

Visual Studio 2010 and .NET Framework 4 Beta 1 Download Today!!!

Resources and excitements are available for you in Visual Studio 2010 Beta 1. Try this out from today at http://go.microsoft.com/fwlink/?LinkId=151799. There are a bunch of resources available for you there apart from the bits. I have installed it with my museum PC (which hold Visual Studio 6, Visual Studio.NET 2003, Visual Studio.NET 2005, Visual Studio.NET… Read more

Choosing between ADO.NET Entity Framework and LINQ to SQL

As part of my day to job I come across a very common question from the developer community that one should be using LINQ to SQL (L2S) or ADO.NET Entity Framework (EF).   Earlier I have posted a blog containing the features http://blogs.msdn.com/wriju/archive/2009/01/05/choosing-between-linq-to-sql-and-entity-framework.aspx.    To me I feel very excited about EF as it has got… Read more

C# 4.0 : New Extension Method “Zip”

While browsing the features I found an interesting extension method called “Zip”. How it works, let’s check it. List<string> names = new List<string> {“Debajyoti”, “Sumitra”, “Wriju” , “Writam”, “Tupur” };   List<int> ages = new List<int>{ 67, 58, 30, 24, 26 };   var zipped = names.Zip(ages, (name, age) => name + ” is “… Read more

C# 4.0 : Named Arguments

For methods having numerous arguments we tend to get confused. And this is also pain for others while reviewing the code. C# 4.0 gives us an opportunity to pass parameters with name. How it works, let’s check it. Suppose you have a method like below, public static class TestClass {    public static void ParamMethod(string… Read more

C# 4.0 : Optional Parameters

Days of creating multiple overloads to avoid parameters are gone. You no more have to create many methods and pass the default one there. C# 4.0 brings to us the concept of “optional” parameters. How it works, let’s check it. Suppose you have a method like below, public static class TestClass {    public static… Read more

C# 4.0 : Dynamic Objects

“Working with dynamic objects statically” – Anders Hejlsberg When you work with C# 4.0 you get to work with many unmanaged world “dynamically”. What does that mean to you? It means you do not do things “statically” as you used to do in C# or in VB.NET. There are many benefits in static programming like… Read more

ADO.NET Entity Framework : Paging EntitySQL

Paging in EntitySQL is really easy to achieve. You have got two important sub-clauses (or query operators) are available, SKIP and LIMIT.   So your paging EntitySQL query would ideally look like, “SELECT VALUE e FROM NorthwindEntities.Customers AS e ORDER BY e.CompanyName SKIP 10 LIMIT 10 “;   The most important part is that you… Read more

Visual Studio 2010 and .NET Framework 4.0 Overview

Know more about it and keep you sink with http://msdn.microsoft.com/en-us/vstudio/products/cc948977.aspx What’s New Overview of WF 4.0, WCF 4.0, and Windows Server “Dublin” Additional Resources Analyst Webcast: Trends and Innovations in the Application Server market Gartner: Magic Quadrant for Enterprise Application Servers Forrester: “Microsoft Is a Leader in Application Server Platforms” IDC Mission Critical Application Platform… Read more