1

Closed

Designer: Entity Framework Model First "edmx:CopyToSSDL" don't work

description

Problem Description:
Since the standard Entity Framework Model Designer does not allow for all SQL data types i wrote an extension for Visual Studio 11 Entity Framework Model Designer to add a custom annotation "SQLDataType". My extension to enter to property in the property pane works fine. It includes the custom property into the CSDL e.g.: Rowversion automatically by database for optimistic locking purposes rowversion But the "Generate Database from Model" does still not copy it to SSDL. I tried it serveral times with different properties. I also completly removed all SSDL from the .edmx file (in XML Editor Mode) just to make sure it is regenerated. I even did it with the standard DDL Generation Template "SSDLToSQL10.tt (VS)" and the standard Workflow, but my custom property never shows up in SSDL, so that I could access it with my modified t4 template to generate the correct SQL create table statement. I use the Entity Framework 5 Version installed with Visual Studio 11 Beta.


lajones: We think there is a bug here. See OutputGeneratorHelpers lines 163 and 170. We look only for the CopyToSSDL attribute with the V2 namespace. We should look for it in either the V2 or V3 namespaces.

More discussion on this issue is available in the original Connect bug - http://connect.microsoft.com/VisualStudio/feedback/details/742802/entity-framework-model-first-edmx-copytossdl-dont-work
Closed May 31, 2013 at 12:29 AM by Mugdhak

comments

moozzyk wrote Dec 3, 2012 at 10:43 PM

I hit this on Friday. We check only for CopyToSSDL elements in v2 edmx namespace

moozzyk wrote Dec 4, 2012 at 5:10 AM

Workaround:

This is a bug. You need to use edmx v2 namespace for the CopyToSSDL attribute even though you are using edmx v3 in general.

Your element would look like this:

<a:SQLDataType edmxv2:CopyToSSDL="true" xmlns:a="http://schemas.teams.com/EntityModelExtensions" xmlns:edmxv2="http://schemas.microsoft.com/ado/2008/10/edmx">rowversion>

If you have more CopyToSSDL attributes feel free to move the namespace definition to the root element so that you don't have to specify it for each element you put the attribute on.

lajones wrote Apr 18, 2013 at 10:08 PM

Fixed with #b3cfb60

Mugdhak wrote May 31, 2013 at 12:29 AM

Verified the fix with Lawrence