dcsimg
 

Submitted by: Srinath M S(srinath_ms@yahoo.com)

Tuesday Aug 21st 2018 by Srinath M S

Language: .NET, Expertise: Intermediate - Learn how explicitly specifying the type can speed up EF 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; }
Home
Mobile Site | Full Site