Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Slowness to retrieve data
Message
From
13/12/2022 01:39:31
 
 
To
06/12/2022 08:44:45
General information
Forum:
C#
Category:
Entity Framework
Miscellaneous
Thread ID:
01685440
Message ID:
01685498
Views:
39
My guess would be the data type of the parameter, depending on the expression you are using in the query.

>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.
Christian Isberner
Software Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform