I am trying to exclude a relationship from a database query using linq in Entity Framework Core.
I have a database where I have a table of Bills and a table of Vendors.
- Each
Bill
has 1Vendor
- Each
Vendor
has manyBills
I want to exclude the List<Bill>
from the Vendor
while maintaining the Vendor
information for the Bill
I am querying. So I can gather Vendor
information from that specific Bill
.
I currently have the relation as below.
foundBills = db_context.Bills.Include(v => v.Vendor).Where(searchLambda).ToList();
Is there a .Exclude
or .Intersect
or something that I am missing to exclude the circular relationship? It is using way too much memory.