find . -name .svn -type d -print0 |xargs -0 rm -rf
Tuesday, 27 January 2015
Deleting svn files and directories, Mac OSX
I recently inherited a project that used to be in svn and is now thankfully in git. Unfortunately all the old svn files were still hanging around. To remove them I did this from the root of the project
Wednesday, 7 January 2015
Entity Framework - Unable to update EntitySet - it has a DefiningQuery and no element exists to support the current operation.
I had this error when working on an older .Net site yesterday with EF4. It seems that the db table wasn't setup with a primary key which apparently makes EF see it as a view. Looking at the XML in the .edmx file revealed this for my table:
<entityset Name="SpecialFeatures" EntityType="EB.Store.SpecialFeatures" store:Type="Tables" store:Schema="dbo" store:Name="SpecialFeatures"> <definingquery>SELECT [SpecialFeatures].[Id] AS [Id], [SpecialFeatures].[ProductDetailIcon] AS [ProductDetailIcon], [SpecialFeatures].[SearchResultsIcon] AS [SearchResultsIcon], [SpecialFeatures].[Name] AS [Name] FROM [dbo].[SpecialFeatures] AS [SpecialFeatures] </definingquery> </entityset>To overcome this problem I performed the following surgery on the db and xml:
- Add a primary key to the db table in SSMS
- Open edmx file in text editor
- Locate the entity in the edmx:StorageModels element
- Remove the DefiningQuery entirely
- Rename the store:Schema="dbo" to Schema="dbo"
- Remove the store:Name property
Subscribe to:
Posts (Atom)