MrD at KookerellaLtd
MrD at KookerellaLtd

Reputation: 2797

Association key '...' not found for type '...' when trying to 'project' schema

consider this code (that works)

var results98 =
    (from record in x.Psi.Psiproductparts
     from infoRecord in record.Programpressinforecords
     let p =
        new ES_WONPROGRAMPRESSINFORMATIONRECORD()
        {
            record_title = infoRecord.PpiTitle
        }
     select p.record_title).ToArray();

So I'm taking some records from a table, projecting it into a new object and then dereferencing the result via the projected object..it works

this code doesn't

var results97 =
    (from record in x.Psi.Psiproductparts
     let bar = 
         new ES_PRODUCT
         {
            p_product_programpressinformationrecords =
                from infoRecord in record
                    .Programpressinforecords
                select new ES_WONPROGRAMPRESSINFORMATIONRECORD()
                {
                    record_title = infoRecord.PpiTitle
                }
         }
    from infoRecord2 in bar.p_product_programpressinformationrecords
    select infoRecord2.record_title).ToArray();

this results in

LinqToDB.Linq.LinqException HResult=0x80131500 Message=Association key 'Oid' not found for type 'Linq2DbPostgresWon.ES_PRODUCT.

yet the code seems little difference in principle to the previous example, weirdly the code seems to be trying to find an association on the projected type.

ES_PRODUCT is simply this

class ES_PRODUCT
{
    public IEnumerable<ES_WONPROGRAMPRESSINFORMATIONRECORD>? p_product_programpressinformationrecords { get; set; }
}

a dumb carrier of a dumb carrier, its not a table

Upvotes: 0

Views: 57

Answers (1)

MrD at KookerellaLtd
MrD at KookerellaLtd

Reputation: 2797

This works in 6.0.0.preview.1

It didn't work in 5.4.1

(thanks to Svyatoslav Danyliv)

Upvotes: 0

Related Questions