magic wrote:
I don't understand why there wouldn't be a lookUp functionality based on an unique index which essentially should be the same as the one based on an UK.
Because these aren't read as unique constraints. If you want unique constraint behavior, define a unique constraint. . Additionally, if you really want this, you can alter the driver code. In driver CatalogRetriever code, the unique constraints are retrieved. If you additionally retrieve the unique index meta-data and create DBUniqueConstraint objects as well, you'll get the meta-data in the catalog and everything else should work as normal.
magic wrote:
I also have another problem with the UK lookUp: Is there a way to make the fetch through the UK constraint case independent? Similar to what you suggested for a predicate comparison:
http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=14804
I would like to identify the strings case independent, but store them in the case they were input by the user.
There's a way. You have to filter similar when filtering case-insentivie. Additional, it's recommended to set EntityFieldCore.CaseSensitiveStringHashCodes = true if the involved field participates in FKs or prefetchPaths:
// ensure that the PK/FK will be synchronized and merged correctly when
// the casing at DB side differs
EntityFieldCore.CaseSensitiveStringHashCodes = true;
// make sure the entity is found, when the casing differs
FieldLikePredicate filter = new FieldLikePredicate(CocoFields.Name, null, "AAA");
filter.CaseSensitiveCollation = true;
// fetch the entity via UC
CocoEntity coco = new CocoEntity();
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.FetchEntityUsingUniqueConstraint(coco, new PredicateExpression(filter));
}
Obviously, it's recommended that this kind of casing situations would be managed DB-side when possible.