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 9024691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:05:16+00:00 2026-06-16T06:05:16+00:00

I have an entity type called Image that inherits from Publication (there are 5

  • 0

I have an entity type called Image that inherits from Publication (there are 5 other types of Publications, all share 10 common properties).

Unfortunately, The Image table in my DB includes 4 binary columns with the data for 4 versions of the image at different resolutions, so there are 4 properties of the EF Image type: BinOriginal, BinHiRes, BinLowRes, BinThumbnail, that contain very large amounts of data.

This is affecting performance. I don’t want to grab all of the binary data when I’m just generating a series of image links, for example.

So I’ve tried table-splitting, placing the 4 binary fields into a new ImageFile entity a la: http://blogs.msdn.com/b/adonet/archive/2008/12/05/table-splitting-mapping-multiple-entity-types-to-the-same-table.aspx

I’ve ensured the correct table-mapping, added the 1-1 association and included the referential constraint, but I’m getting this error:

Error 3033: Problem in mapping fragments starting at line 2731:EntitySets 
'ImageFiles' and 'Publications' are both mapped to table 'Images'. Their primary 
keys may collide.

… it seems there’s a problem in that the table being split is involved in an inheritance relationship.

I’ve tried inheriting the new ImageFile EF type from Publication, but then I get an error:

Problem in mapping fragments starting at lines 2332, 2374:Two entities with 
different keys are mapped to the same row

QUESTION Is there any way around this, or does the fact that I need the Image EF type to inherit from Publication preclude splitting off the other fields into a new type?

  • 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-16T06:05:18+00:00Added an answer on June 16, 2026 at 6:05 am

    You can consider this a limitation of Entity Framework: there’s actually two pieces, the Model of the underlying database item, and the Entity that is build from Model. The subclass of the Entity doesn’t affect the Model whatsoever.

    If you don’t want to load all of the data for a Model row, project it:

    var results = from product in myDB.Products
                  where product.Id == productId
                  select New 
                  {
                      Id = product.Id, 
                      Name = product.Name, 
                      ImageUrl = product.ImageUrl
                  };
    

    The SQL query that Entity Framework creates only selects the columns in the select clause of the LINQ query.

    This also keeps Entity Framework from storing the table row into the ObjectContext (or DBContext for EF 5) object.

    As a side note, I’d be personally tempted to store largish binary data in a NoSQL solution, and just maintain the associated key in the SQL database myself.

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

Sidebar

Related Questions

I have an Abstract type called Product, and five Types that inherit from Product
I have a simple base entity type called EntityBase that implements IEquatable<EntityBase>. I've used
I have an entity in EF called Registry that I use for throwing all
There is an entity type called Product that is generated by entity framework. I
I have an entity class called catObras, and it inherits from the class NSManagedObject.
I have two entities types: RunContainer parent entity type Run child entity type Run
I have a Web Service call that returns reporting data using Linq-To-Entity (strongly type
In entity framework I have an Entity 'Client' that was generated from a database.
I have a Member entity with a complex type called Address with a complex
I have an entity called Object, here is the yaml code: Entities\Object: type: entity

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.