This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I've noticed that if I add an entity to a collection it first does a select on the collection. In my example below I create a blog post entity from a helper and then add it the blog entities collection. I notice it first does a select on all the posts that belong to the blog then it does the insert. Eg this causes a select before the insert:
var y = CreateNewBlogPost(); this doesn't but it will still do the insert
var y = CreateNewBlogPost();
Is that correct behaviour? Isn't the select unnecessary? Remove does the same thing. |
|
|
Yes, it is correct behaviour. Accessing the Blog.Posts property causes the Posts collection to load, which is where the SELECT comes from. I guess we could be even lazier and load the Posts collection only when you access its contents, which would avoid the SELECT in write-only scenarios, but that adds a layer of complexity that we don't feel is justified. |
|
|
That is, to clarify in terms of the thread title: it is not the .Add() which causes the SELECT. It is the .Posts. |
|