次のlinqをsqlにラムダ式に変換するにはどうすればよいですか?ありがとう。LambdaクエリをLambdaに変換する
var existing = (from a in db.sms_imported_trn_code
where !db.sms_description.Any(m => m.trn_code == a.trn_code)
select new { trn_code = a.trn_code }).ToList();
編集:私は次のクエリを試してみましたが、そのは私にエラーを与えて
。下の画像をご覧ください。
私のモデルクラスは、あなたが「s.sms_description」を書いているので、あなたがエラーを取得している
public class sms_imported_trn_code
{
public int id { get; set; }
public string trn_code { get; set; }
List<sms_imported_trn_code> sms_import_list { get; set; }
}
}
public class sms_description
{
public int id { get; set; }
public string trn_code { get; set; }
public string Description { get; set; }
[DisplayFormat(DataFormatString = "{0:MMM-dd-yyyy}", ApplyFormatInEditMode = true)]
public DateTime create_date { get; set; }
public string created_by { get; set; }
}
なぜこれを行う必要がありますか? – sr28
そして、尋ねる前に何を試してみましたか?これはあなたを助けるかもしれません:https://codeblog.jonskeet.uk/2011/01/28/reimplementing-linq-to-objects-part-41-how-query-expressions-work/ –
[ask]を読んで研究を共有してください実際のエラーに向かってエラーがなければ、私たちはあまりできません。 – CodeCaster