Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Slowness to retrieve data
Message
General information
Forum:
C#
Category:
Entity Framework
Miscellaneous
Thread ID:
01685440
Message ID:
01685448
Views:
51
Hi,

You can use MS SQL Server Profiler and check differents calls between from ADO.NET and EF code.

MartinaJ

>Hi
>I am facing slowness issue when retrieve data via entityframework 6.
>It query a table, with return 20 records only. The SQL statement is fast, completed within sec
>
>However, when I use EF code as below, it takes 11-15 secs.
>
>
>public class EmployeesDTO
>    {
>        public EmployeesDTO() { }
>        public string employeeNo { get; set; }
>    }
>
>DbContext dbCtx = new DbContext("connectionstring");
>SqlParameter para = new SqlParameter("@yearFor", SqlDbType.Char, 4);
>string = "select ....";
>para.Value = eaReportConfig.yearFor;
>IList<EmployeesDTO> empList = dbCtx.Database.SqlQuery<EmployeesDTO>(sql, para).ToList(); // slowness
>
>//Or
>
>DbRawSqlQuery<EmployeesDTO> empList = dbCtx.Database.SqlQuery<EmployeesDTO>(sql, para);
>foreach(EmployeesDTO emp in empList) // slowness
>{
>}
>
>EmployeesDTO
>Any idea? If I use normal ADO.NET code, it is fast.
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Reply
Map
View

Click here to load this message in the networking platform