LINQ to Entities Union is throwing an error

后端 未结 2 883
终归单人心
终归单人心 2021-01-12 00:00

I have managed to get the following working:

var transactions = from t in context.Transactions
                   group t.Create_Date_Time by t.Participation         


        
2条回答
  •  旧时难觅i
    2021-01-12 00:45

    Most likely t1.Key and i1.Key are different types. The anonymous types must have exactly the same property names and types, declared in the same order for you to be able to union them.

    As a side note, you probably also want to change this line of your code:

    transactions.Union(cases);
    

    to this:

    var unionedQuery = transactions.Union(cases);
    

    otherwise it won't perform the union, because you've not stored the resulting query.

提交回复
热议问题