Pergunta

So I have a table that is loaded with a few ManyToOne joins.

If any of these joins are broken (ie. have a key reference where the joined table does not contain that key) an exception gets thrown unless you set the property 'NotFoundMode.Ignore'.

I've noticed that when there are mismatches, I get a whole lot of extra selects being sent to the database.

The main select is done once, then for each of the mismatches there is an extra select sent out.

I've confirmed this by fixing the references (all the extra selects disappear) and then rebreaking the references (all the selects reappear).

Is there a reason for this?

Foi útil?

Solução

As quickly discussed in the comments above: The setting NotFoundMode.Ignore is really mostly for legacy stuff.

It give us the option how to handle inconsistent foreign-keys in DB. If we cannot fix the underlying tables, we at least can use the not-found="ignore" setting.

Please see these Q&A for some more information, about down side of that setting. It should give the answer, why are "repeated selects" of the "not existing" values issued:

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top