Eliminate Duplicate Records

Posts   
 
    
joejo318
User
Posts: 24
Joined: 16-Jul-2012
# Posted on: 16-Jul-2012 22:42:38   

I have created a View that returns some duplicate records. In Gen Pro, after generating the entity, is there any way to filter out those duplicates in C#?

I tried to set WillPotentiallyCauseDuplicateRows = false but it complains that this property doesn't have setter.

Can anyone help? Thanks.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Jul-2012 06:36:53   

Entity collections are assumed to be based on unique rows, so you can't specify something like "allow duplicates" in the fetch. As you mapped that DB view into an entity, then you should:

  • specify the distinct at the DB view level
  • specify the PK for that entity in "identifying fields" of the entity.
  • you also could filter out duplicates "after" the collection if fetched using in-memory tactics, but I guess that is not what you are looking for.

If this doesn't fit to you, then maybe you shouldn't map that view into an entity. You should map it into a TypedView instead, so you can specify the "allow duplicates" parameter in the typed view fetch.

The "duplicate" concept is narrow in a DB view. What is duplicate? The full data row? Some PK? some subset of columns?

David Elizondo | LLBLGen Support Team