Entity framework. How to right map tables without primary key
<p><a href="https://stackoverflow.com/questions/40220572/mapping-one-to-many-relationship-to-existing-database-views-without-keys">I tried to solve this problem, but couldn't</a> so I'm trying to do it another way.</p>

<p>I have a view that consist of 3 tables without any primary/foreign keys.</p>

<p>VS2015 generated this class:</p>

<pre><code>[Table("SkuBarcodesView")]
public partial class SkuBarcodesView
{
    [Key]
    [Column("_Code", Order = 0)]
    [StringLength(11)]
    public string C_Code { get; set; }

    [Key]
    [Column("_Description", Order = 1)]
    [StringLength(150)]
    public string C_Description { get; set; }

    [Key]
    [Column("_ProductCode", Order = 2)]
    [StringLength(50)]
    public string C_ProductCode { get; set; }

    [Key]
    [Column("_Ref", Order = 4)]
    [StringLength(36)]
    public string C_Ref { get; set; }

    [Key]
    [Column("_Barcode", Order = 5)]
    public string C_Barcode { get; set; }
}
</code></pre>

<p>This entity represents sku-barcode table so I may have row's like these:</p>

<pre><code> Product  | Barcode
 -------- | --------
 product0 | barcode0
 product1 | barcode1 
 product2 | barcode2
 product2 | barcode2
</code></pre>

<p>Now, I need to group it somehow. I'm trying:</p>

<pre><code>using (skumodel db = new skumodel())
{
    var query = db.SkuBarcodesViews.GroupBy(e =&gt; e.C_Ref)
        .Select(g =&gt; new { Barcode = g.C_Barcode });
}
</code></pre>

<p>But, then I see this error:</p>

<blockquote>
  <p>Severity   Code    Description Project File    Line    Suppression State</p>
  
  <p>Error  CS1061  'IGrouping' does not contain a definition for 'C_Barcode' and no extension method 'C_Barcode' accepting a first argument of type 'IGrouping' could be found (are you missing a using directive or an assembly reference?) </p>
</blockquote>

<p><strong>How can I solve this?</strong></p>

<p>This is just a start; there are a lot of other tables in the database without keys/foreign keys that I want to work with through EF. </p>

<p><strong>What is the right way to get data from tables without keys?</strong> How to map tables like these?</p>