Eager Loading
を使用して置き換える方法はLazy loading
?
このように言いましょう。私は以下の種類のEFクエリをたくさん持っています。パフォーマンスに関しては、Include keys
これは非常に遅いです。
では、以下のコードを使用してパフォーマンスを向上させるにはどうすればよいLazy loading
ですか?
from owner in Catalog.Owners
where owner.Key == ownerKey
from invoice in owner.Invoices
where invoice.Provider.Key == providerKey
where invoice.Id == id
select invoice)
.Include(i => i.Owner.Credits)
.Include(i => i.Provider)
.Include(i => i.Items.Select(s => s.Allocation.Service))
.Include(i => i.Items.Select(s => s.Allocation.Pet))
.FirstOrDefault();
サンプルコードの説明をいただければ完璧です。