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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:23:31+00:00 2026-06-13T11:23:31+00:00

I am using entity model.i updated one view called SalesDetialView. In salesdetialview i have

  • 0

I am using entity model.i updated one view called SalesDetialView.

In salesdetialview i have 3 entity keys. There are 1.Type 2.No, 3.Custmor
enter image description here

SQL : I am using this query(i am printing just 5 columns )

select Customer,Type,No,Salesperson,amount from SalesDetailView
enter image description here

But through entity model i am not getting duplicate values(No).see this below screen enter image description here

Now i have doubt why it is not showing duplicate values. Any thing related for entity keys or any thing. Please suggest me where i am doing mistake.

  • 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-13T11:23:33+00:00Added an answer on June 13, 2026 at 11:23 am

    If multiple rows share the same value in the primary column(s), only the first of these seems to be retrieved from the database and copied into these other rows. For instance, if a set has 2 columns, with the first being marked as the primary column, and

    the correct result should be:
    
    A, 1
    A, 2
    B, 4
    B, 6
    B, 7
    C, 5
    
    
    The actual result in code with Entity Framework would become:
    
    
    A, 1
    A, 1
    B, 4
    B, 4
    B, 4
    C, 5
    

    When including a view in your Entity Model, the model seems to simply use the first not-nullable columns as primary key (as all columns used in the primary key should be non-nullable).
    To fix the problem, make sure that the primary key columns are chosen correctly. If you cannot create the correct primary key because of null-values or simply not having set of columns that differs for each row, try adding a column to your view that always contains a unique value for each row. After you add it, make sure it is set as the primary key in your Entity Model.

    If I would set both rows to be the Primary Columns in the above example, I would get the desired result.

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

Sidebar

Related Questions

I have entity model like this (using EclipseLink and JPA 2.0): @Entity class A
I am learning to develop windows forms application with Entity Framework using Model View
I am using the Model View View-Model pattern for a WPF app. I have
I have this classes who is mapped using Entity Framework Code First: public class
General Info: ASP.NET MVC app using ADO.NET Entity Framework SQL Server 2005 I have
I have an MVC3 project using the Entity Framework model in which I've marked
I'm helping develop a MVC application in Visual Studio 2008 using the Entity Model
I am creating a new database model using Entity Framework 4.3 Code-FIrst; using Fluent
I'm using an ADO.NET Entity Model which I'm trying to query using LINQ. The
I am building a MVVM application. The model / entity (I am using NHibernate)

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.