How to use DebugView to Log Entity Framework

In this post I will show you to use DebugView to log the Entity Framework. For detail discussion on the same topic you may want to learn more here:

Logging in Entity Framework on Steve Smith Blog

Profiling Database Activity in the Entity Framework by Julie Lerman

Download DebugView , unzip it and Run it as administrator. In Capture menu select the options as shown in below image,


Once the debugview is configured, you should configure the DataContext class as shown below. Enable database log to print on the debug window.


As the last step run the application using Entity framework without using Visual Studio or without attaching Visual Studio Debugger. In Visual Studio run the application using Ctrl+ F5. You should able to view the Entityframework log in Debugview as follows:


The Debugview can be your good friend when you stuck with performance issues and want to log the queries.

Happy Coding.

Work with ASP.NET MVC 5 Areas from different projects

Read full article on Falafel blog

While working on an ASP.NET MVC 5 application, I came across a requirement to use an Area from one project in another project. For example: I have a project A and a project B. I need to use an Area which is part of project B inside of project A. In this post I will discuss how this can be achieved.

To start with, let us say I have an MVC project AreaDemo with the structure as follows:


Read full article on Falafel blog

Using AutoMapper : Getting Started

Read full article on Falafel blog

I have often seen developers use the LINQ SELECT statement to create a new instance of one class from an existing instance of another class. There are many scenarios when you may have to do this, for example:

  • Creating the domain class instance from the entity class instance
  • Creating the DTO class instance from the entity class instance
  • Creating the POCO class instance from the entity class instance etc.

To do this, developers often use the select statement or manually convert a class object to another class object. Let’s look at an example:

Read full article on Falafel blog

Walkthrough: Login with Twitter Account in ASP.NET MVC 5 APP using ASP.NET Identity 2.0

ASP.NET Identity 2.0 simplifies task of social authentication in an ASP.NET MVC App at the great extent. There are lot to learn about ASP.NET Identity 2.0 and in further posts I will cover that. However In mean time if you are curious you can find the resources for ASP.NET Identity 2.0 here

To start with I created an ASP.NET MVC Application in Visual Studio 2013 y choosing MVC project template as follows:


Great, once the project is created next you need to configure Twitter for the application. To start with navigate to and select Create New App as shown below:


To create the Twitter application fill the form as follows. Off course you should provide Name, Description and Website information as of your application. Callback URL filed is worth discussing here, for development environment use instead of localhost as the server for Callback URL. For any other server give fully qualified server name. To create the new Twitter application form can be filled as follows:


That’s it. Now click on API Keys and copy the API Key and API Secret, you will need them in the application.


At the last step you need to open the project and browse to the App_Start folder. In this folder you will find a file Startup.Auth.cs. Open this file and uncomment the code app.UseTwitterAuthentication. You should also provide the consumerKey and consumerSecret key from Twitter here. (we created these keys in previous steps)



This is it Press F5 to run the application. And click on Login, you should see the Twitter option in Use another Service to log in.


Click on the Twitter option and you will be asked to authorize the app.


Once authorization is done, you can register with the Twitter username.


Now you are logged in to the application using Twitter account. So as you see ASP.NET Identity 2.0 makes it super easy to work with social authentication in the ASP.NET MVC or the ASP.NET application.

In further posts, I will share more on ASP.NET Identity 2.0 learning. Happy Coding.

User Instance login flag is not allowed when connecting to a SQL Server instance: Solved

While working with an ASP.NET MVC application I encountered following exceptions:


Exception clearly says that user instance login flag is not allowed when connecting to a SQL Server instance. For sure this error is related to SQL Server instance I am working on in this particular application. I examined the connection string in the web.config file.


There are two important points about this connection string:

  1. It points to local SQL Server database.
  2. User Instance is set to true

All local database runs under user instance and hence they don’t allow to configure user instance value in the web.config file. Removing User Instance entry should solve this problem. I modified connection string as follows:


And changing this resolved the issue. Hope it helps.