Click here to Skip to main content
15,940,550 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
I work on Blazor application server side. I design web API to interact with razor pages.

My issue is which is suitable for my scenario? Using ADO.NET or Entity Framework Core?

What I try is as below:

So is using data reader ADO.NET better or using Entity Framework Core?

Some developers tell me why use ADO.NET. It is old technology and this is not good because it opens and closes connection with every load page and entity framework does not do that.

Also, is ADO.NET easy for hacking from Entity Framework Core?

Is this correct?

Is that better or using Entity Framework Core?

I depend on code first technology.

Result of the statement above is 10000 rows as maximum.

What I have tried:

        public IActionResult GetAllServersDetails()
            string query = "";
            query = "select s.ServerID, s.Server_Name as ServerName,isnull(s.ServerIp,'') as ServerIp,s.ServerTypeId,isnull(st.ServerType,'') as ServerType,s.OsTypeId,isnull(os.DetailsName,'')  as OsType,s.HostedZoneId,isnull(hostedzone.DetailsName,'') as HostedZone,s.ServerityId,isnull(serverity.DetailsName,'') as Serverity,s.HostedTypeId,isnull(hostedType.DetailsName,'') as HostedType,isnull(s.ServerRoleId,0) as ServerRoleId,isnull(serverrole.DetailsName,'') as ServerRole,isnull(s.DRRequired,0) as DRRequiredID,isnull(drrequired.DetailsName,'') as DRRequired,isnull(s.Remarks,'') as Remarks,isnull(s.OwnerFileNo,'') as ownerfilenumber, s.IsActive from [dbo].[ServerNames] s with(nolock)
inner join [dbo].[ServerTypes] st with(nolock) on st.ServerTypeId=s.ServerTypeId
left join  Details os with(nolock) on os.ID=s.OsTypeId and os.HeaderId=12
left join  Details hostedzone with(nolock) on hostedzone.ID=s.HostedZoneId and hostedzone.HeaderId=13
left join  Details serverity with(nolock) on serverity.ID=s.ServerityId and serverity.HeaderId=14
left join  Details hostedType with(nolock) on hostedType.ID=s.HostedTypeId and hostedType.HeaderId=15
left join  Details serverrole with(nolock) on serverrole.ID=s.ServerRoleId and serverrole.HeaderId=16
left join  Details drrequired with(nolock) on drrequired.ID=s.DRRequired and drrequired.HeaderId=17";

                ICollection<object> ApplicationsDataValues = 
                new List<object>();
                using (var command = 
                    command.CommandText = query;
                    command.CommandType = CommandType.Text;


                    using (var reader = command.ExecuteReader())
                        while (reader.Read())
                                ServerID = reader.GetFieldValue<Int32>(0),
                                ServerName = 
                                ServerIp = reader.GetFieldValue
                                ServerTypeId = 
                                ServerType = reader.GetFieldValue
                                OsTypeId = reader.GetFieldValue
                                OsType = reader.GetFieldValue
                                HostedZoneId = 
                                HostedZone = 

                                ServerityId = reader.GetFieldValue<Int32>(9),
                                Serverity = reader.GetFieldValue<string>(10).ToString(),

                                HostedTypeId = reader.GetFieldValue<Int32>(11),
                                HostedType = reader.GetFieldValue<string>(12).ToString(),

                                ServerRoleId = reader.GetFieldValue<Int32>(13),
                                ServerRole = reader.GetFieldValue<string>(14).ToString(),

                                DRRequiredID = reader.GetFieldValue<string>(15).ToString(),
                                DRRequired = reader.GetFieldValue<string>(16).ToString(),
                                Remarks = reader.GetFieldValue<string>(17).ToString(),
                                ownerfilenumber = reader.GetFieldValue<string>(18).ToString(),
                                IsActive = reader.GetFieldValue<bool>(19)//.ToString()
                return StatusCode
                   (200, ApplicationsDataValues); // Get all users   
            catch (Exception e)
                return StatusCode(500, e);
Updated 3-Oct-23 6:34am
[no name] 2-Oct-23 20:18pm    
EF is a wrapper for ADO.NET; it's not an "or" question.
Dave Kreskowiak 2-Oct-23 20:31pm    
EFCore runs on top of ADO.NET, and every piece of information you gave in your question is wrong.
PIEBALDconsult 2-Oct-23 21:56pm    
Yeah, it's not an matter of "or". Just use and cut out the middleman.

1 solution

I would compare EF Core with Dapper, not Ado.Net. Here are a couple of videos that go into detail...
* Entity Framework Core vs Dapper Performance in 2023 - YouTube[^]
* Making Entity Framework Core As Fast As Dapper - YouTube[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900