View Single Post
  #5 (permalink)  
Old September 28th, 2014, 04:21 PM
FrugalRacer FrugalRacer is offline
Registered User
Points: 24, Level: 1
Points: 24, Level: 1 Points: 24, Level: 1 Points: 24, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2013
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts

That did help.

I refreshed the model as directed, then when I rebuilt the website, I got the following error:

Error 1 Error 3002: Problem in mapping fragments starting at line 210:Potential runtime violation of table Picture's keys (Picture.Id): Columns (Picture.Id) are mapped to EntitySet Pictures's properties (Pictures.Id) on the conceptual side but they do not form the EntitySet's key properties (Pictures.Description, Pictures.Id, Pictures.ImageUrl, Pictures.PhotoAlbumId, Pictures.ToolTip).
C:\BegASPNET\Site\App_Code\PlanetWrox.edmx 211 15 C:\BegASPNET\Site\

I searched in the .edmx file for ImageUrl and found this:
<EntityType Name="Picture">
            <PropertyRef Name="Id" />
            <PropertyRef Name="Description" />
            <PropertyRef Name="ToolTip" />
            <PropertyRef Name="ImageUrl" />
            <PropertyRef Name="PhotoAlbumId" />
          <Property Type="Int32" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Type="String" Name="Description" Nullable="false" MaxLength="300" FixedLength="true" Unicode="true" />
          <Property Type="String" Name="ToolTip" Nullable="false" MaxLength="50" FixedLength="true" Unicode="true" />
          <Property Type="String" Name="ImageUrl" Nullable="false" MaxLength="200" FixedLength="true" Unicode="true" />
          <Property Type="Int32" Name="PhotoAlbumId" Nullable="false" />
          <NavigationProperty Name="PhotoAlbum" Relationship="PlanetWroxModel.FK_Picture_PhotoAlbum" FromRole="Picture" ToRole="PhotoAlbum" />
I removed all but the "Id" line from the "Key" entry, rebuilt the web site, and everything works.

Thanks for your help!
Reply With Quote