This is with LLBLGen 3.5, Self Servicing.
While using ORMProfiler, I noticed that if I run code like this:
XEntity x = new XEntity(); // Create a new X
YEntity y = new YEntity(); // Create a new Y
x.GetMultiYs(false).Add(y); // Add a new Y Entity to the Y collection
// set properties on x, y
x.Save(true);
then as soon as the code calls GetMultiYs, there is a database fetch of all Y entities related to an XEntity where XId = 0.
I was surprised that accessing a collection on a new entity would cause a database access, since a new entity can't have related entities. I'd like to avoid that fetch for performance reasons if possible.
I've found that I can work around the issue by setting x.AlreadyFetchedYs = true, but I'm wondering if that's necessary. In my real code I will have quite a large number of AlreadyFetchedXXX's properties to set.
Or perhaps I've missed something and there's a different pattern of code I should be using to avoid the fetch in cases like this.
Thanks for any advice,
Wesley