devxlogo

Speed Up Entity Framework Queries

Speed Up Entity Framework Queries

Queries like the one below will perform more slowly than they could be run on a varchar column.

Explicitly marking them as such will improve the performance of EF queries as it would query with the right type.

dataContext.Tables.Where(k = k.MyStringProperty == someValue); Explicit type specification on the property though the Column attribute. [Column(TypeName="varchar")] public string MyStringProperty { get; set; }

devx-admin

Share the Post: