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

  • SEARCH
  • Home
  • 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 8164911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:25:14+00:00 2026-06-06T19:25:14+00:00

OK, this is an interesting and most importably real urgent problem for me to

  • 0

OK, this is an interesting and most importably real urgent problem for me to solve… In order for others to neatly comprehend it, I’ve stretched myself to make a well illustrated post.


The Object Model

So I have this simple, easy and “beautiful” model in mind. See the first picture. (You can ignore PathEntry, it’s not relevant in my situation.)

The idea is that a MediaFeedItem owns:

  • a collection of ThumbnailFileEntries (accesible through the ThumbnailFiles property)
  • at most 1 raw FileEntry (MetadataFile property) and
  • at most 1 MediaFileEntry (MediaFile property)

We shall refer to these last three entity types as the file entities.

Now there’s more: As you can see, I am inheriting both ThumbnailFileEntry and MediaFileEntry from FileEntry, and let’s not debate that! (for now), it’s one of those end-of-story aspects of the design and both entity types will continue to grow later on.

EDMX Model Diagram

This already brings me some significant issues right away in regards to the polymorphic associations induced by the relationships from the file entities to MediaFeedItem.

The first thing that you shall observe is that I have eliminated the navigation property from the derived file entities (ThumbnailFileEntry and MediaFileEntry) to the primary entity MediaFeedItem.

MediaFeedItem_MediaFile association

I do this because they already inherit that property defined in the base class FileEntry. As you can see, I do not delete the roles at the end of these associations.

MediaFeedItem_MetadataFile association


The Relational Model

I shall be using the so-vastly-conceptually-superior TPT strategy for generating and mapping my Object Model to the RDB world (vs TPH/TPC).

I’m using EF5-rc, the EDMX model designer to design my model, and the EF5 DbContext Generator to generate a DbContext and POCOs cuz I wanna use the DbContext API.

As you can see, I can nicely generate the database model using the EF tools:

DB Model Diagram


The Problem

When loading a new MediaFeedItem and saving it, I get the following error:

System.InvalidOperationException: Multicplicity constraint violated. The role ‘MetadataFile’ of the relationship ‘MediaFeedModel.MediaFeedItem_MetadataFile’ has multiplicity 1 or 0..1.

What am I doing wrong?

  • 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-06-06T19:25:15+00:00Added an answer on June 6, 2026 at 7:25 pm

    Looking at your problem one thing stands out, The FK relationship between File and MediaFeedItem is required (IE a file must have a MediaFeedItem), but in the case where you are in an extended version of File you probably dont want this.

    What i think you want to do is one of the following:

    • change the multiplicity on MediaFeedItem_FileEntry to 0..1 – 0..1 so that it isnt required at either end
    • create a new extended type to handle your metadataFile type and remove the direct reference between the base type and MediaFeedItem

    I personally think the second is a more elegant solution to your problem as its creating an actual type for your MetadataFile

    What appears to be happening is that you are trying to create an extended type but the base type isnt actually a metadata file.

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

Sidebar

Related Questions

there's this interesting problem i can not solve myself. I will be very glad,
I just looked at this posting: What is the best or most interesting use
I recently came in contact with this interesting problem. You are given a string
I've started playing alittle with erlang, and find it most interesting. My problem is
Well hello, this is the most interesting bug/conflict I've ever faced. In python shell,
I found this interesting behavior. Why could this happen I am using the cmdlet
I was reading this interesting post on metaclasses What is a metaclass in Python?
I have this interesting obstacle on my project. I am currently doing a MVC3
i have been reading this interesting article which is increasing my every growing confusion
I found this interesting site, that helps me understand derivatives, http://www.numberempire.com/derivatives.php , It seems

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.