mvc classic sql vs EF

Is there anyone who has experience with migrating to EF from classic SQL.

I am familiar with this code:

using(MySqlConnection b = new MySqlConnection()) {
    b.ConnectionString = varAccordingToServer.StandardMySQLConnectionString;
    b.Open();
    c.Connection = b;
    c.CommandText = "select count(*) from myTable where condition='1'";
    string t = c.ExecuteScalar().ToString();
}

If I start using EF, will there be any performance loss?

Thanks,

Upvotes: 1

Views: 89

Answers (2)

i3arnon
i3arnon

Reputation: 116558

With great abstractions come great performance losses.

Yes, there might be some performance loss, but in most application it doesn't really matter. I suggest you try the EF way, and if you prove some part of it hinders performance, optimize this part specifically. EF will probably improve your code and team's velocity enough that you'll have time to worry about performance later.

Upvotes: 4

Leo
Leo

Reputation: 14830

Yes, there is going to be a performance loss whenever you choose an ORM tool such as EF or NHibernate. The performance loss might be insignificant though. Now, the least of your worries should be performance, the major headache you will see is using a connector that fully supports Entity Framework for MySql...well, I'm assuming your backend database is a MySql database. I still haven't bumped into a connector that doesn't drop support for some features.

Upvotes: 2

Related Questions