When generating a model from the database the designer adds some attributes in the "http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" previously we would define the namespace on the Schema element (root element for SSDL) and give it the "store" prefix. Now we no longer treat it in a special way and therefore the XmlWriter defines the namespace as needed and creates a potentially random prefix.
Expected:
Namespace defined on the Schema element as: ```xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator"```
and
```
<EntityContainer Name="ParentChildModelStoreContainer">
<EntitySet Name="ChildEntities" EntityType="Self.ChildEntities" Schema="dbo" store:Type="Tables" />
<EntitySet Name="ParentEntities" EntityType="Self.ParentEntities" Schema="dbo" store:Type="Tables" />
<AssociationSet Name="FK_ParentEntityChildEntity" Association="Self.FK_ParentEntityChildEntity">
```
Actual:
```
<EntityContainer Name="ParentChildModelStoreContainer">
<EntitySet Name="ChildEntities" EntityType="Self.ChildEntities" Schema="dbo" p3:Type="Tables" xmlns:p3="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
<EntitySet Name="ParentEntities" EntityType="Self.ParentEntities" Schema="dbo" p3:Type="Tables" xmlns:p3="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
<AssociationSet Name="FK_ParentEntityChildEntity" Association="Self.FK_ParentEntityChildEntity">
```
Note that the fix is probably in runtime since we now use runtime to write the model.
Comments: Resolved with changeset #96553c <Everyone loves:xml="even though" xmlns:loves="to annoy everyone" /> Fix for 1499: Serialized SSDL contains auto generated namespace prefix for store extensions When doing db reverse engineering the designer puts some attributes to the "http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" namespace. Since we did not write the namespace declaration on one of the ancestor elements the xml writer would write the namespace declaration on all elements that needed this namespace and - because we used it for attributes - it would also make up a safe namespace prefix similar to "p3" which made elements look like this: <EntitySet Name="ChildEntities" EntityType="Self.ChildEntities" Schema="dbo" p3:Type="Tables" xmlns:p3="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" /> This was regression for the designer where in the previous version we used to define the "store" namespace prefix for the namespace and used to write the namespace declaration on the Schema element which made elements look like this: <EntitySet Name="ChildEntities" EntityType="Self.ChildEntities" Schema="dbo" store:Type="Tables" /> The fix is to write the namespace declaration on the Schema element if needed (note currently we only check entity sets since this is the only place the designer is creating attributes in this namespace) which associates the prefix with the namespace uri and makes the xml writer use this prefix instead of inventing random prefixes on its own.
Expected:
Namespace defined on the Schema element as: ```xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator"```
and
```
<EntityContainer Name="ParentChildModelStoreContainer">
<EntitySet Name="ChildEntities" EntityType="Self.ChildEntities" Schema="dbo" store:Type="Tables" />
<EntitySet Name="ParentEntities" EntityType="Self.ParentEntities" Schema="dbo" store:Type="Tables" />
<AssociationSet Name="FK_ParentEntityChildEntity" Association="Self.FK_ParentEntityChildEntity">
```
Actual:
```
<EntityContainer Name="ParentChildModelStoreContainer">
<EntitySet Name="ChildEntities" EntityType="Self.ChildEntities" Schema="dbo" p3:Type="Tables" xmlns:p3="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
<EntitySet Name="ParentEntities" EntityType="Self.ParentEntities" Schema="dbo" p3:Type="Tables" xmlns:p3="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
<AssociationSet Name="FK_ParentEntityChildEntity" Association="Self.FK_ParentEntityChildEntity">
```
Note that the fix is probably in runtime since we now use runtime to write the model.
Comments: Resolved with changeset #96553c <Everyone loves:xml="even though" xmlns:loves="to annoy everyone" /> Fix for 1499: Serialized SSDL contains auto generated namespace prefix for store extensions When doing db reverse engineering the designer puts some attributes to the "http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" namespace. Since we did not write the namespace declaration on one of the ancestor elements the xml writer would write the namespace declaration on all elements that needed this namespace and - because we used it for attributes - it would also make up a safe namespace prefix similar to "p3" which made elements look like this: <EntitySet Name="ChildEntities" EntityType="Self.ChildEntities" Schema="dbo" p3:Type="Tables" xmlns:p3="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" /> This was regression for the designer where in the previous version we used to define the "store" namespace prefix for the namespace and used to write the namespace declaration on the Schema element which made elements look like this: <EntitySet Name="ChildEntities" EntityType="Self.ChildEntities" Schema="dbo" store:Type="Tables" /> The fix is to write the namespace declaration on the Schema element if needed (note currently we only check entity sets since this is the only place the designer is creating attributes in this namespace) which associates the prefix with the namespace uri and makes the xml writer use this prefix instead of inventing random prefixes on its own.