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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:25:27+00:00 2026-06-09T12:25:27+00:00

This question is related to this question which was never answered. I have a

  • 0

This question is related to this question which was never answered. I have a more real world example here though – so hoping for some help.

I have an auction, bid and auctiondetail(a flattened table) class.
I am trying to include my bids in the auction as well as auctiondetail table, auction and auctiondetail have the same PK

using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;

namespace OnCall.VirtualWarehouse.Data.Models.Auctions
{
    using System;

    public class AuctionCopy
    {
        public Guid AuctionCopyId { get; set; }

        public virtual Collection<BidCopy> BidCopies { get; set; }

    }

    public class BidCopy
    {
        public Guid BidCopyId { get; set; }

        public Guid AuctionCopyId { get; set; }

        public AuctionCopy AuctionCopy { get; set; }


    }

    public class AuctionDetailCopy
    {
        [Key]
        public Guid AuctionCopyId { get; set; }

        public virtual Collection<BidCopy> BidCopies { get; set; }
    }

}

Here’s my DBContext:

public class DataContext : DbContext
{
    static DataContext()
    {
        Database.SetInitializer(new DropCreateIfChangeInitializer());
    }

    public DataContext()
    {
        Configuration.ProxyCreationEnabled = false;
    }

    public IDbSet<AuctionCopy> AuctionCopy { get; set; }

    public IDbSet<BidCopy> BidCopy { get; set; }

    public IDbSet<AuctionDetailCopy> AuctionDetailCopy { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);

        modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
    }

    public void Seed(DataContext context)
    {

    }
}

When generating the database, I get

    The operation failed because an index or statistics with name 'IX_AuctionId' already exists on table 'Bids'. 

Any ideas how I can get this to work?

  • 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-09T12:25:29+00:00Added an answer on June 9, 2026 at 12:25 pm

    The bug come from EF4.3 (and 4.3.1).
    It should be fixed for the next release.

    Have a look on Unhandled Exception after Upgrading to Entity Framework 4.3.1. They purpose a workaround using migration system.

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

Sidebar

Related Questions

This question is related to the one I asked here . I'm trying to
This question is related to awk, I suppose. I have no experience with awk.
I've seen this question around the internet ( here and here , for example),
This question is related to my earlier question here: python update outer passed value
This question has two aspects, both related to indices. I have a dataset with
[This question is essentially reopening git crash during rebase which never had an answer]
This is kind of related to my previous question, but not really. I have
This question relates to this question which I asked earlier this week. The answer
This question relates to those parts of the KenKen Latin Square puzzles which ask
This was one of my interview questions which i couldn't answer.... Is it related

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.