Wriju's BLOG

.NET, Cloud and everything

What’s new in Windows Azure

What’s new in Windows Azure which is coming up next? In PDC 2010 bunch of new features like, Virtual Machine Role Extra Small Instance Virtual Network Remote Desktop Azure Marketplace And many more. To find more on it http://www.microsoft.com/windowsazure/pdcannouncements/ I feel strongly that, with VMRole and Remote Desktop migration will be much more easier. We… Read more

SQL Server Performance Tips

SQL Server Performance Series – Part 1 – Introduction to Performance Tuning http://www.msteched.com/2010/Europe/DAT340 SQL Server Performance Series – Part 2 – Server and Database Tuning http://www.msteched.com/2010/Europe/DAT341 SQL Server Performance Series – Part 3 – Query and Index Tuning http://www.msteched.com/2010/Europe/DAT342 Namoskar!!!… Read more

Batch Download PDC 2010 Session

If you are a developer PDC is for you and this PDC 2010 has a lot of things for a Developer. You feel boring while downloading one by one. Life is easy as another great developer wrote a tool to do it most elegantly. http://blogs.msdn.com/b/mark/archive/2010/11/03/pdc10-downloader.aspx?wa=wsignin1.0 Once you have downloaded all of them you can rename… Read more

ADO.NET Entity Framework POCO Resources

Some of the available finest resources on POCO MSDN Articles Requirements for Creating POCO Proxies Loading Related POCO Entities Tracking Changes in POCO Entities How to: Define POCO Entities How to: Define a Custom Object Context How to: Customize Modeling and Mapping Files to Work with Custom Objects How to: Define a Custom Object Context… Read more

Closing a Windows Form by pressing ESC key

While I was developing one Windows Forms application, it was required for me to close the popup forms when user will press ESC key. I tried adding the Form’s KeyPress event. It was not working as expected. Then I thought I should write a code to find all the controls to my form and add… Read more

Learn Windows Phone 7 in 31 Days

http://www.jeffblankenburg.com/post/31-Days-of-Windows-Phone-7.aspx Day #1: Project Template Day #2: Page Navigation Day #3: The Back Button Paradigm Day #4: Device Orientation Day #5: System Theming Day #6: Application Bar Day #7: Launchers Day #8: Choosers Day #9: Debugger Tips Day #10: Input Scope (on-screen Keyboard) Day #11: Accelerometer Day #12: Vibration Controller Day #13: Location Services Day… Read more

Team Foundation Server 2010 on the Cloud

Today at Microsoft PDC 2010 Brian Harry showed a demo of TFS 2010 installed and hosted on the cloud. This is super cool stuff. Because you do not need to install and configure TFS 2010 on premises. Rather you provision the Team Foundation Server and just have your Visual Studio 2010 connected to it. More… 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

Internet Explorer 9 / IE 9 Download From Here

Internet Explorer 9 or IE9 is simply magic and launched today (Sept 15, 2010). Download it from here at http://windows.microsoft.com/en-US/internet-explorer/download/ie-9/worldwide Lots of canned demos are at http://ie.microsoft.com/testdrive/. I personally liked the HTML 5 power http://ie.microsoft.com/testdrive/ Namoskar!!!… 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

SharePoint 2010 : Are you new?

Developing Applications for SharePoint 2010 Brief Description This guidance provides technical information about key areas of SharePoint 2010 application development. It contains a written guide, reference implementations with source code and documentation, and a library of reusable source code components. http://www.microsoft.com/downloads/details.aspx?familyid=64B55569-2168-4545-8B7C-F185B2CF967D&displaylang=en SharePoint 2010 Walkthrough Guide Brief Description This walkthrough guide is designed to provide a… 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

SQL Server 2008 R2 Management Studio designer was not allowing me to add primary key to a column of an empty table

What the heck!!! Then finally Amar did help me to get it done. Simple “option”. Life has too many “options”. Tools > Options You need to just uncheck the option “Prevent saving changes that require table re-creation” Namoskar!!!… Read more

Every Developer needs to be Social

This is exactly Scott Hanselman communicated on which we live our everyday life. How were those days when there were only books and different CDs of MSDN. Then Google and Bing came into the picture. Being a developer how we drink resource and make them useful for others. https://channel9.msdn.com/posts/Glucose/Hanselminutes-on-9-Social-Networking-for-Developers-Part-1-Every-Developer-Needs-a-Blog/ Every developer should watch it !!!… 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 : DataBinding with Windows Presentation Foundation (WPF)

This post is to give an idea on how easily we can bind and create master details display in WPF.   Here I am using Northwind sample database and using Category and Products tables. These two tables are connected with each other through CategoryId. We will create a model using these two tables. Please ensure… Read more

ADO.NET Entity Framework 4.0 : DataBinding with Windows Forms

This post is to give an idea on how easily we can bind and create master details display in Windows Forms Application.   Here I am using Northwind sample database and using Category and Products tables. These two tables are connected with each other through CategoryId. We will create a model using these two tables…. Read more

ADO.NET Entity Framework 4.0 : DataBinding with ASP.NET

This post is to give an idea on how easily we can bind and create master details display in ASP.NET. Here I am using Northwind Sample database and using Category and Products tables. These two tables are connected with each other through CategoryId. We will create a model using these two tables. Please ensure that… 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

Free Guide Books from Microsoft

Over the years Microsoft is releasing Patterns and Practices books and distributing them for free. I think this one as great community effort and is continue to evolve. When I started writing code in .NET I always used to carry them with me. You cannot ask for more if you have them with you. In… 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