none
The End property specified as part of this MSL does not exist in MetadataWorkspace. RRS feed

  • Question

  • Hi, guys,

    I was trying to manually create EF metadata to really get a grip on it and, after clearing a lot of manually created bugs, can't go around this one. The metadata goes like this...

    SSDL:

    <?xml version="1.0" encoding="utf-8"?>
    <Schema Namespace="SecurityServiceModels.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
     <EntityContainer Name="SecurityServiceStoreContainer">
      <EntitySet Name="Roles" EntityType="SecurityServiceModels.Store.Roles" store:Type="Tables" Schema="dbo" />
      <EntitySet Name="Users" EntityType="SecurityServiceModels.Store.Users" store:Type="Tables" Schema="dbo" />
      <EntitySet Name="Users_Roles" EntityType="SecurityServiceModels.Store.Users_Roles" store:Type="Tables" Schema="dbo" />
      <AssociationSet Name="FK_Users_Roles_Users" Association="SecurityServiceModels.Store.FK_Users_Roles_Users">
       <End Role="UsersInRole" EntitySet="Users" />
       <End Role="RolesInUser" EntitySet="Users_Roles" />
      </AssociationSet>
      <AssociationSet Name="FK_Users_Roles_Roles" Association="SecurityServiceModels.Store.FK_Users_Roles_Roles">
       <End Role="RolesInUser" EntitySet="Roles" />
       <End Role="UsersInRole" EntitySet="Users_Roles" />
      </AssociationSet>
     </EntityContainer>
     <EntityType Name="Roles">
      <Key>
       <PropertyRef Name="Id" />
      </Key>
      <Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
      <Property Name="Name" Type="varchar" MaxLength="512" Nullable="false" />
      <Property Name="Description" Type="varchar(max)" />
     </EntityType>
     <EntityType Name="Users">
      <Key>
       <PropertyRef Name="Id" />
      </Key>
      <Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
      <Property Name="Name" Type="varchar" MaxLength="512" Nullable="false" />
      <Property Name="Description" Type="varchar(max)" />
     </EntityType>
     <EntityType Name="Users_Roles">
      <Key>
       <PropertyRef Name="UserId" />
       <PropertyRef Name="RoleId" />
      </Key>
      <Property Name="UserId" Type="int" Nullable="false" />
      <Property Name="RoleId" Type="int" Nullable="false" />
     </EntityType>
     <Association Name="FK_Users_Roles_Users">
      <End Role="UsersInRole" Type="SecurityServiceModels.Store.Users" Multiplicity="1" />
      <End Role="RolesInUser" Type="SecurityServiceModels.Store.Users_Roles" Multiplicity="*" />
      <ReferentialConstraint>
       <Principal Role="UsersInRole">
        <PropertyRef Name="Id" />
       </Principal>
       <Dependent Role="RolesInUser">
        <PropertyRef Name="UserId" />
       </Dependent>
      </ReferentialConstraint>
     </Association>
     <Association Name="FK_Users_Roles_Roles">
      <End Role="RolesInUser" Type="SecurityServiceModels.Store.Roles" Multiplicity="1" />
      <End Role="UsersInRole" Type="SecurityServiceModels.Store.Users_Roles" Multiplicity="*" />
      <ReferentialConstraint>
       <Principal Role="RolesInUser">
        <PropertyRef Name="Id" />
       </Principal>
       <Dependent Role="UsersInRole">
        <PropertyRef Name="RoleId" />
       </Dependent>
      </ReferentialConstraint>
     </Association>
    </Schema>
    

    CSDL:
    <?xml version="1.0" encoding="utf-8"?>
    <Schema Namespace="SecurityServiceModels" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
     <EntityContainer Name="SecurityServiceEntities" annotation:LazyLoadingEnabled="true">
      <EntitySet Name="Roles" EntityType="SecurityServiceModels.Role" />
      <EntitySet Name="Users" EntityType="SecurityServiceModels.User" />
      <AssociationSet Name="Users_Roles" Association="SecurityServiceModels.Users_Roles">
       <End Role="RolesInUser" EntitySet="Roles" />
       <End Role="UsersInRole" EntitySet="Users" />
      </AssociationSet>
     </EntityContainer>
     <EntityType Name="Role">
      <Key>
       <PropertyRef Name="Id" />
      </Key>
      <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
      <Property Name="Name" Type="String" Nullable="false" MaxLength="512" />
      <Property Name="Description" Type="String" />
      <NavigationProperty Name="Users" Relationship="SecurityServiceModels.Users_Roles" FromRole="RolesInUser" ToRole="UsersInRole" />
     </EntityType>
     <EntityType Name="User">
      <Key>
       <PropertyRef Name="Id" />
      </Key>
      <Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
      <Property Name="Name" Type="String" Nullable="false" MaxLength="512" />
      <Property Name="Description" Type="String" />
      <NavigationProperty Name="Roles" Relationship="SecurityServiceModels.Users_Roles" FromRole="UsersInRole" ToRole="RolesInUser" />
     </EntityType>
     <Association Name="Users_Roles">
      <End Role="RolesInUser" Type="SecurityServiceModels.Role" Multiplicity="*" />
      <End Role="UsersInRole" Type="SecurityServiceModels.User" Multiplicity="*" />
     </Association>
    </Schema>
    
    MSL:
    <?xml version="1.0" encoding="utf-8"?>
    <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
     <EntityContainerMapping StorageEntityContainer="SecurityServiceStoreContainer" CdmEntityContainer="SecurityServiceEntities">
      <EntitySetMapping Name="Roles">
       <EntityTypeMapping TypeName="SecurityServiceModels.Role">
        <MappingFragment StoreEntitySet="Roles">
         <ScalarProperty Name="Id" ColumnName="Id" />
         <ScalarProperty Name="Name" ColumnName="Name" />
         <ScalarProperty Name="Description" ColumnName="Description" />
        </MappingFragment>
       </EntityTypeMapping>
      </EntitySetMapping>
      <EntitySetMapping Name="Users">
       <EntityTypeMapping TypeName="SecurityServiceModels.User">
        <MappingFragment StoreEntitySet="Users">
         <ScalarProperty Name="Id" ColumnName="Id" />
         <ScalarProperty Name="Name" ColumnName="Name" />
         <ScalarProperty Name="Description" ColumnName="Description" />
        </MappingFragment>
       </EntityTypeMapping>
      </EntitySetMapping>
      <AssociationSetMapping Name="Users_Roles" TypeName="SecurityServiceModels.Users_Roles" StoreEntitySet="Users_Roles">
       <EndProperty Name="Roles">
        <ScalarProperty Name="Id" ColumnName="RoleId" />
       </EndProperty>
       <EndProperty Name="Users">
        <ScalarProperty Name="Id" ColumnName="UserId" />
       </EndProperty>
      </AssociationSetMapping>
     </EntityContainerMapping>
    </Mapping>
    

    I'm getting theses compilation messages:
    SecurityService.msl(23,8) : error 2009: The End property 'Roles' specified as part of this MSL does not exist in MetadataWorkspace.
    SecurityService.msl(26,8) : error 2009: The End property 'Users' specified as part of this MSL does not exist in MetadataWorkspace.

    Any ideas of what I'm doing wrong?


    Bigsby, Lisboa, Portugal
    O que for, quando for, é que será o que é...
    Wenn ist das Nunstruck git und Slotermeyer? Ja! ... Beiherhund das Oder die Flipperwaldt gersput!
    http://bigsby.eu
    Wednesday, August 18, 2010 11:32 AM

Answers

  • I got it.


    Damn naming and documentation.

    Who would of that the property EndProperty.Name, in MSL AssociationSetMapping, and that the documentation describes as "The name of the association end that is being mapped." refferes, after all, to the name of a Role.

    The correct MSL AssociationSetMapping should look like this:

     <AssociationSetMapping Name="Users_Roles" TypeName="SecurityServiceModels.Users_Roles" StoreEntitySet="Users_Roles">
      <EndProperty Name="RolesInUser">
      <ScalarProperty Name="Id" ColumnName="RoleId" />
      </EndProperty>
      <EndProperty Name="UsersInRole">
      <ScalarProperty Name="Id" ColumnName="UserId" />
      </EndProperty>
     </AssociationSetMapping>
     </EntityContainerMapping>
    </Mapping>
    




    Bigsby, Lisboa, Portugal
    O que for, quando for, é que será o que é...
    Wenn ist das Nunstruck git und Slotermeyer? Ja! ... Beiherhund das Oder die Flipperwaldt gersput!
    http://bigsby.eu
    • Marked as answer by Bigsby Wednesday, August 18, 2010 3:52 PM
    Wednesday, August 18, 2010 3:52 PM