6

Closed

UseStrongSpatialTypes annotation missing when upgrading CSDL 2.0 to CSDL 3.0 with the designer

description

When upgrading CSDL 2.0 to CSDL 3.0 with the designer the UseStrongSpatialTypes annotation (set to false) is not added to the schema. This may result in a message/exception saying: "Currently, spatial types are only supported when used in CSDL files that have the UseStrongSpatialTypes annotation with a false value on their root Schema element". Note that the error will be shown only after adding a spatial property to the model - if there are no spatial properties the annotation is not needed.

Repro steps:
  1. Create an app with 2.0 model (i.e. In VS2012 create an app, target .NET Framework 4.0 and a model)
  2. Re-target the app to target .NET Framework 4.5 (this should upgrade artifacts to version 3.0)
  3. With the designer add a spatial property to an entity
    Expected behavior:
    The model is valid
    Actual behavior:
    An error reading: "Currently, spatial types are only supported when used in CSDL files that have the UseStrongSpatialTypes annotation with a false value on their root Schema element"
Closed May 29, 2013 at 7:39 PM by BriceLambson
Verified

comments

mattcsharp wrote Dec 18, 2012 at 6:59 AM

Does anyone know the workaround to resolve this? Just ran into this. Thanks!

moozzyk wrote Dec 18, 2012 at 5:22 PM

The workaround is to manually add the missing annotation. Here are the steps: - Open the edmx file with the Xml Editor (right click, select "Open With...", press 1000 times OK to allow opening the edmx file with the Xml Editor) - Find the Schema element in the http://schemas.microsoft.com/ado/2009/11/edm namespace (it should be under edmx:ConceptualModels) - Add the following attributes to the Schema element : xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" annotation:UseStrongSpatialTypes="false" (leave xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" out if it is already there). The Schema element should look like this: <Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" Namespace="Model1" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" annotation:UseStrongSpatialTypes="false"> Save the file and double click on the .edmx file in the solution explorer to open it with the designer.

mattcsharp wrote Dec 18, 2012 at 6:33 PM

Worked perfectly. The only thing I'd add for future reference is to ensure that you modify Namespace="Model1" to be the correct namespace as listed in your previous Schema element. Thanks very much!

moozzyk wrote Dec 19, 2012 at 4:35 PM

Good point. The Schema example I provided was for reference only - sorry for not being clear enough.

lajones wrote Apr 18, 2013 at 10:09 PM

Fixed with #60f5ce2

BriceLambson wrote May 29, 2013 at 7:39 PM

Verified

rcfearn wrote Aug 18, 2013 at 3:16 AM

Thank you!