I am using Entity Framework to access an Oracle Database. I have an entity with a property called "AOID". The the mapping file for this entity, I have the following rules applied (notice the IsRequired):
this.Property(t => t.Aoid)
.IsRequired()
.HasMaxLength(25);
However, when I run a SQL Profiler report or an AWR report, a query keeps showing up with the following where clause:
WHERE ((((UPPER("Extent2"."AOID")) = (UPPER(:p__linq__0))) OR ((UPPER("Extent2"."AOID") IS NULL) AND (UPPER(:p__linq__0) IS NULL)))
Why is entity framework adding the NULL checks to the where clause when the property is marked as required? These NULL checks are preventing the indexes from being used properly.