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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:42:26+00:00 2026-05-22T02:42:26+00:00

I use Entity Framework in my ASP.NET application (.NET 3.5) My model is simple:

  • 0

I use Entity Framework in my ASP.NET application (.NET 3.5)
My model is simple:

Order (Id)
Product (Id, OrderId)
Category (Id, ProductId, NameA, NameB)

My code looks like:

StoreEntity db = new StoreEntity(); 
Order order = GetOrder(1);
Product product = new Product();
product.Categories.Add(new Category() { NameA = "1" });
product.Categories.Add(new Category() { NameA = "2" });
product.Categories.Add(new Category() { NameA = "3" });
product.Categories.Add(new Category() { NameB = "A" });
product.Categories.Add(new Category() { NameB = "B" });
product.Categories.Add(new Category() { NameB = "C" });
order.Products.Add(product);
db.SaveChanges();

Problem is that in database categories are in wrong order, that is:

CategoryId,ProductId,NameA,NameB
1,1,3,NULL
2,1,2,NULL
3,1,1,NULL
4,1,NULL,C
5,1,NULL,B
6,1,NULL,A

When I switch to .NET 4 row order is correct. Is there a way to fix this in 3.5 ?

  • 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-22T02:42:27+00:00Added an answer on May 22, 2026 at 2:42 am

    As I know no EF version will ensure that items will be inserted in the same order as created in the application. If it works in EFv4 it will be most probably just luck because I have many examples where order is different in EFv4 as well.

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

Sidebar

Related Questions

For my ASP.NET MVC 2 application I use Entity Framework 1.0 as my data
I have a ASP.NET MVC 2.0 application using Entity Framework. All my views use
How do I use Datatable instead of Entity framework in Asp.Net mvc? I'm referring
I'm writing a log parser for an asp.net mvc2 web application. I use Entity
So I've started to add Entity Framework 4 into a legacy web application (ASP.NET
I'm using the Entity Framework as my ORM for an ASP.Net (webforms) application. Suppose
I have my asp.net mvc 3 application with entity framework and i used the
Our current enterprise solution is a ASP.NET MVC application driven by the Entity Framework.
I am building an ASP.Net MVC 3 application with Entity Framework 4. When the
I am developing a rich client application that will use the Entity Framework (with

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.