Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1093745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:52:11+00:00 2026-05-16T23:52:11+00:00

I’m kind of stuck working out where I’m going wrong with the below entity

  • 0

I’m kind of stuck working out where I’m going wrong with the below entity framework mapping. What I’ve done is:

a) created a Sqlite database (see below, noting Sqlite doesn’t allow FK constraints)
b) created a blank Entity Data Mode & then created the model from the database
c) issue is then trying to add the Model association so it picks up and uses the “ProcessNameId” column I’ve created in the database in the USAGES table. I’ve been trying to use the GUI Table Mapping pane to do this but it doesn’t seem too intuitive.

Issue – I’m getting the following error:

Error 3 
Error 3021: Problem in mapping fragments starting at line 85:
Each of the following columns in table Usages is mapped to multiple conceptual side properties:

Usages.ProcessNameId is mapped to <ProcessNameUsage.ProcessName.Id,  ProcessNameUsage.Usage.Id>
Error   4
Error 3025: Problem in mapping fragments starting at line 85:
Must specify mapping for all key properties (Usages.Id) of table Usages.

Question – So the question is what changes to the XML do I need to make to have the association work correctly?

SQL

CREATE TABLE "ProcessNames" (
    "Id" INTEGER PRIMARY KEY  AUTOINCREMENT NOT NULL , 
    "Name" VARCHAR NOT NULL  UNIQUE
)

CREATE TABLE "Usages" (
    "Id" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL , 
    "ProcessNameId" INTEGER NOT NULL , 
    "Amount" INTEGER NOT NULL , 
    "Datetime" DATETIME NOT NULL 
)

Model Config

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="Model1.Store" Alias="Self" Provider="System.Data.SQLite" ProviderManifestToken="ISO8601" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="Model1StoreContainer">
          <EntitySet Name="ProcessNames" EntityType="Model1.Store.ProcessNames" store:Type="Tables" />
          <EntitySet Name="Usages" EntityType="Model1.Store.Usages" store:Type="Tables" />
        </EntityContainer>
        <EntityType Name="ProcessNames">
          <Key>
            <PropertyRef Name="Id" />
          </Key>
          <Property Name="Id" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="Name" Type="nvarchar" Nullable="false" />
        </EntityType>
        <EntityType Name="Usages">
          <Key>
            <PropertyRef Name="Id" />
          </Key>
          <Property Name="Id" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProcessNameId" Type="integer" Nullable="false" />
          <Property Name="Amount" Type="integer" Nullable="false" />
          <Property Name="Datetime" Type="datetime" Nullable="false" />
        </EntityType>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema xmlns="http://schemas.microsoft.com/ado/2008/09/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">
        <EntityContainer Name="Model1Container" annotation:LazyLoadingEnabled="true">
          <EntitySet Name="ProcessNames" EntityType="Model1.ProcessName" />
          <EntitySet Name="Usages" EntityType="Model1.Usage" />
          <AssociationSet Name="ProcessNameUsage" Association="Model1.ProcessNameUsage">
            <End Role="ProcessName" EntitySet="ProcessNames" />
            <End Role="Usage" EntitySet="Usages" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="ProcessName">
          <Key>
            <PropertyRef Name="Id" />
          </Key>
          <Property Type="Int64" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Type="String" Name="Name" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" />
          <NavigationProperty Name="Usages" Relationship="Model1.ProcessNameUsage" FromRole="ProcessName" ToRole="Usage" />
        </EntityType>
        <EntityType Name="Usage">
          <Key>
            <PropertyRef Name="Id" />
          </Key>
          <Property Type="Int64" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Type="Int64" Name="ProcessNameId" Nullable="false" />
          <Property Type="Int64" Name="Amount" Nullable="false" />
          <Property Type="DateTime" Name="Datetime" Nullable="false" />
          <NavigationProperty Name="ProcessName" Relationship="Model1.ProcessNameUsage" FromRole="Usage" ToRole="ProcessName" />
        </EntityType>
        <Association Name="ProcessNameUsage">
          <End Type="Model1.ProcessName" Role="ProcessName" Multiplicity="1" />
          <End Type="Model1.Usage" Role="Usage" Multiplicity="*" />
        </Association>
      </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
    <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
  <EntityContainerMapping StorageEntityContainer="Model1StoreContainer" CdmEntityContainer="Model1Container">
          <EntitySetMapping Name="ProcessNames">
            <EntityTypeMapping TypeName="Model1.ProcessName">
              <MappingFragment StoreEntitySet="ProcessNames">
                <ScalarProperty Name="Name" ColumnName="Name" />
                <ScalarProperty Name="Id" ColumnName="Id" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Usages">
            <EntityTypeMapping TypeName="Model1.Usage">
              <MappingFragment StoreEntitySet="Usages">
                <ScalarProperty Name="Datetime" ColumnName="Datetime" />
                <ScalarProperty Name="Amount" ColumnName="Amount" />
                <ScalarProperty Name="ProcessNameId" ColumnName="ProcessNameId" />
                <ScalarProperty Name="Id" ColumnName="Id" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="ProcessNameUsage" TypeName="Model1.ProcessNameUsage" StoreEntitySet="Usages">
            <EndProperty Name="ProcessName">
              <ScalarProperty Name="Id" ColumnName="ProcessNameId" />
            </EndProperty>
            <EndProperty Name="Usage">
              <ScalarProperty Name="Id" ColumnName="ProcessNameId" />
            </EndProperty>
          </AssociationSetMapping>
        </EntityContainerMapping>
</Mapping></edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
    <edmx:Connection>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
        <DesignerProperty Name="EnablePluralization" Value="True" />
        <DesignerProperty Name="IncludeForeignKeysInModel" Value="False" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="Model1" >
        <EntityTypeShape EntityType="Model1.ProcessName" Width="1.5" PointX="0.75" PointY="0.75" Height="1.2636116536458317" />
        <EntityTypeShape EntityType="Model1.Usage" Width="1.5" PointX="3" PointY="0.75" Height="1.7566536458333339" />
        <AssociationConnector Association="Model1.ProcessNameUsage">
          <ConnectorPoint PointX="2.25" PointY="1.4639794921875002" />
          <ConnectorPoint PointX="3" PointY="1.4639794921875002" />
        </AssociationConnector>
      </Diagram>
    </edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:52:12+00:00Added an answer on May 16, 2026 at 11:52 pm

    If you want to expose the foreign key ID and also have the EF manage the relationship, you can use Foreign Key Associations, but these are only available in EF 4.0

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a reasonable size flat file database of text documents mostly saved in
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.