There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?

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:

Create an app with 2.0 model (i.e. In VS2012 create an app, target .NET Framework 4.0 and a model)

Re-target the app to target .NET Framework 4.5 (this should upgrade artifacts to version 3.0)

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"

comments

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.