Thursday, July 8, 2010

Unable to update the EntitySet 'MyEntity' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

If you are using the ADO.NET Entity Framework and a Domain Service (I don’t think you have to be using a Domain Service to have this issue) and you get the error:

Unable to update the EntitySet 'MyEntity' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

One common reason you get this is that the table you are trying to update doesn’t have a single primary key in the database. This then causes the Entity Framework to create a compound key of all the non-nullable columns.

To solve the issue, just create a primary key on the table and update your model. You will have to manually change the Entity Key property to False for all the properties that are not your primary key.

If you are not so lucky to have just forgot to create a primary on the database table, then you may check out this forum for more info on options. I was lucky, I just needed to add a primary key to my table. :) Good luck.

Tuesday, July 6, 2010

WinDirStat – What is eating up all my hard disk free space?

Have you ever wondered where all your free space on your hard drive has gone? Have you every wondered how to find files or folders that are taking up a lot of space? Or maybe what percent of your disk is taken up by the Windows directory?

Well if you have, I suggest using WinDirStat. It is OpenSource and thus free. It takes just a minute to download and install and takes around 1MB of diskspace. It is quite fast at analyzing your disk also. I highly recommend it.

Here is the link for info (including screenshots) and download links.