Blog from Saravanan Arumugam

Let us talk about Technologies

Category Archives: Exceptions and Solutions

‘__Entities’: type used in a using statement must be implicitly convertible to ‘System.IDisposable’

I have a solution where my working project references the project having the Entity Data Model. When I create the entity model context with the using statement I get the following compiler error.


Error 2 ‘Intrado.Data.MyEntities’: type used in a using statement must be implicitly convertible to ‘System.IDisposable’ C:\Saravanan\MyApp\MyApp.Service.cs 16 13 MyApp.Service


We can find this issue when the entity model is in a different project than the working project. We get this exception since the Compiler knows till the point that the entity class (MyEntities in my example) is derived from ObjectContext. For some reason C# compiler can’t understanding that ObjectContext has implemented the IDisposible.

To resolve it, simply add a reference to the System.Data.Entity in the working project. This should take care of this error.


The specified named connection is either not found in the configuration

I created a entity data model in one project and used it by referencing in a different project. .Net framework didn’t let me do this just by adding a project reference.


I got the following exception.

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid


When I searched for a solution to this issue, I got a strange answer as the solution. Even though the project containing the entity model contains the named connection string in its app.config, it was required to copy it to the configuration file of the project referencing the entity. I had to manually copy the connection string from the app.config to the configuration of the web application where I used the entity.

Saving changes is not permitted

For my recent project, I was creating some tables using the SQL server designer. After creating tables, I tried to change the primary key to be of Identity column.


The change could not be saved and I received the following error message.

Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either…



It’s a defensive mechanism that SQL server offers us to prevent accidental loss of data due to unintentional changes. It is good to have this system on.

Following list of actions might require a recreation of the table, deleting the existing records.

  • Adding a new column to the middle of the table

  • Dropping a column

  • Changing column nullability

  • Changing the order of the columns

  • Changing the data type of a column

However, if you are sure enough that the change is intentional and you are aware the the table would be deleted and re-created, then you may proceed with the following step to override the defense system.

Select the Tools menu –> Options in the SQL server management studio.

In the Options dialog box, expand the Designers on the tree view and select Table and Designers. On the right hand side, uncheck the option, Prevent saving changes that require table re-creation.


Then select Ok. Now the designer should allow you to save the changes.

Again, be aware that when you save the changes, the entire table might be deleted and the existing records might get lost to accommodate the change.

Reference: Save (Not Permitted) Dialog Box

The process cannot access the file because it is being accessed by another process

When I tried to create a virtual machine in Hyper-V with Windows 7, I received this message when I pressed Action –> Start.


[Window Title]
Virtual Machine Connection

[Main Instruction]
Capturing the drive failed.

Failed to add device ‘Microsoft Virtual CD/DVD Disk’.

Failed to open attachment ‘D:’. Error: ‘The process cannot access the file because it is being used by another process.’

[Expanded Information]
‘Windows Server 2’ failed to add device ‘Microsoft Virtual CD/DVD Disk’. (Virtual machine ID 534773DB-D548-44E0-8C5F-5094801065A8)

‘Windows Server 2’: Failed to open attachment ‘D:’. Error: ‘The process cannot access the file because it is being used by another process.’ (0x80070020). (Virtual machine ID 534773DB-D548-44E0-8C5F-5094801065A8)

[^] Hide details  [Close]

This message didn’t allow me to install windows 7 with the DVD.


I used DVD drive to install windows server 2008 in a different virtual machine. So the DVD drive was captured by the other virtual machine. So I connected to the Windows Server 2008 virtual machine. Selected Media Menu –> DVD drive –> Uncapture D:.

This action released the DVD drive.

Now I went back to the virtual machine of Windows 7. Selected Media –> DVD drive –> Capture D:.

This action captured the DVD drive for this virtual machine and started the installation of Windows 7.

WCF Data Service not found in “Add New Items” list

I just studied some heads up about WCF Data services and their implementation. I wanted to try it out. As per the instruction given in the demo video, I created a Framework 4.0 application in Visual Studio 2010 and got to the point of Add New Items. I could not find the “WCF Data Service”


WCF Data Service would not appear in the Add New Item dialog box.

I could not find the WCF Data Service because I had created a console application. My expectation of finding a WCF template in Console application was a fair one since a regular WCF service can be created in any Project type.



You can find the template only in the Web Application Project. It doesn’t appear in any other project type, even in the Silverlight. At this point I don’t have the answer for why the WCF Data Service is not shown in other templates though. However, “AppFabric-enabled WCF Data Service” can be found in all the project templates.