Archive for November 2010
I have an Entity Framework 1.0 (aka 3.5) project (I wish we could upgrade to 4) and I recently got this error:
Problem in Mapping Fragments starting at lines 1987, 2308: Non-Primary-Key column(s) [ColumnBlah] are being mapped in both fragments to different conceptual side properties – data inconsistency is possible because the corresponding conceptual side properties can be independently modified.
It turns out it was caused because the person who created the table didn’t put a foreign key constraint on the column and so I had to add one. When I updated the EF model it saw the constraint and added the corresponding navigation property to the entities BUT it kept the original scalar property and was still mapping it to the table column. So now I had a property in an entity mapped to a column in the underlying table AND a navigation property mapped to the same column.
Simple solution: I deleted the scalar property from the entity.
Hope that helps someone.
I know that software has to be gotten out and on time, thus we have to triage bugs and sometimes leave a bug in a product because it doesn’t crash it and there is a workaround, but I don’t agree with leaving this one in IE8 Developer Tools.
Here’s the story:
I try to open the IE8 Developer Tools (F12 or “Tools > Developer Tools”) and nothing happens.
I hunt around and find that the app appears in the taskbar and in the Alt-Tab list but when I select it, nothing happens.
I Google the issue and find this IE 8 Developer Tools not working In Windows?
Some of the suggestions don’t work. Here is what worked for me in Windows 7:
- Select IE in the taskbar
- Right-Click on the Developer Tools icon and select “Maximize”
- Click on the title bar and pull the app down so that it changes its size to a non-maximized window (It doesn’t work to double-click the title bar, it just minimizes again)
- Now close the tools and close IE8
- When you open IE8 again open the tools and the app should be a window and not minimized.
- I had to do this a few times to get it to work so it’s possible step 4 should be “close IE8 and then close the tools”.
If you find that the tools are somehow off your screen then try this:
- Select IE in the taskbar
- Select the tools app
- Press Alt-tab and then “M” (this opens the application menu and activates “Move”.
- Use your keyboard arrow keys to move the app into view.
- I haven’t had that problem with the tools, but have with other applications
Sheesh! What a pain in the butt!
If Microsoft wants to persuade web developers that IE is not the anti-Christ they are not going about it in a very smart way.
I got this error today and it made no sense at all:
The type 'some_class_name' exists in both 'some_temp.dll' and 'some_other_temp.dll'
The only change I’d made was to some css.
Here’s how I got the error: I had made some changes to a particular user control before I figured out that the layout problem was in the css. I didn’t want to lose my changes, just in case I needed them, so I made copies of the ascx file and its designer file. Then I reverted all changes, modified the css and ran the web site – clang! The error happened.
After googling it, shutting down the VS web server, clearing out the temp ASP.NET folder, cleaning the solution in Visual Studio, rebuilding, rebooting, etc., etc., and nothing working, I finally figured it out.
It was the copies of the files. Despite the fact that the copies were NOT part of the project, the VS web server was compiling them. So of course there were classes with duplicate names.
Once the copies were removed the web site ran fine.
(2011-11-04: I noticed a lot of activity on this post and I realized that the solution I use most is in one of the comments way down the page. So I have written an additional article here, Entity Framework 4 – The selected stored procedure returns no columns (part 2), to highlight it. I suggest you do read the solutions given below because they may apply and could help improve your stored procedure but if you are in a hurry the part 2 article gives you a fast fix.)
You create a stored procedure, you bring it into your entity model, you start to create a function import, you click the “Get Column Information” button and you get “The selected stored procedure returns no columns.”
The reasons I’ve seen for this are:
- You are returning your result set using dynamic sql, so EF can’t figure out at design time what the shape of the results will be.
- You are selecting from a temp table and EF can’t figure out the shape of the results at design time.
- Your stored procedure crosses databases and although you have all the rights you need in the database containing the sproc, you don’t have the necessary rights to the database objects in the other database. E.g., you don’t have select rights on a table in the other database.
The solutions I’ve found are:
- Alter your sproc so the result set structure can be figured out at design time. E.g., put the results into a table variable and select from that.
- Create a dummy sproc with the same name and signature as the final sproc that contains a select statement which creates a result set with the desired structure. (E.g., select cast(1 as int), cast(“a” as varchar(20)) … etc.) Refresh your entity model and add the function import – EF will see the structure and you can create the Entity to receive the results. Now replace the dummy sproc in the database with your final version.
- Use a table variable instead of a temp table
- Give the user that is calling the sproc the correct rights in the other database or databases.
I hope people find that useful.
(2010-12-19: See my reply to minkbear’s comment below for another possible solution.)