I am new to Visual Studio, C#, .NET and Core. I also regularly work with legacy systems (iSeries) and PHP to communicate with it. Everyday, I ask myself: What did you learn today? This is the result.
Dapper! I love it! I gave EF a try, but just didn't seem to fit my needs. I considered learning EF Core and was advised "if you know Dapper, why bother?". I feel control over my models with Dapper, and as a full stack developer, see my holes in "query" logic immediately. Plus, eliminate the heavy overhead.. always a plus!
Currently developing futuristic smart-device, IoT connected, highway construction site safety system in EU.
Used to work on infrastructure, application architecture and cloud engineering.
I'm sorry but aren't you giving up what ORM is for?
Portability? Do you like replacing all "SELECT TOP X" by "SELECT ... LIMIT X" when porting from MSSQL to MySQL?
What about security and performance (aka SQL injection and SQL plan caching)? Do you write every query as "
DECLARE @param1 int
DECLARE @param2 varchar(20)
DECLARE @param3 datetime
SELECT first,last,login,password,birthdate,street,city,country
FROM Users
WHERE age >= @param1
AND login = @param2
AND created <= @param3"
instead of "
var result = Users.Where(age >= 30 && login = UserLogin && created >= Datetime.Now(-30)).AsList();"
? Don't you feel you're sacrificing something?
Portability is always the first reason that comes up for using an ORM, and I wonder how often switching DB vendors actually happens in the real world.
Also, when using Dapper you really don't need those DECLAREs as it infers them from the values you pass in.
Lastly, your own example shows the cost of the ORM convenience. For instance, say you only need ID and Name for populating a drop-down list, an ORM will select each and every column in the table, whereas in SQL you can SELECT ID, Name.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Dapper! I love it! I gave EF a try, but just didn't seem to fit my needs. I considered learning EF Core and was advised "if you know Dapper, why bother?". I feel control over my models with Dapper, and as a full stack developer, see my holes in "query" logic immediately. Plus, eliminate the heavy overhead.. always a plus!
I'm sorry but aren't you giving up what ORM is for?
Portability? Do you like replacing all "SELECT TOP X" by "SELECT ... LIMIT X" when porting from MSSQL to MySQL?
What about security and performance (aka SQL injection and SQL plan caching)? Do you write every query as "
DECLARE @param1 int
DECLARE @param2 varchar(20)
DECLARE @param3 datetime
SELECT first,last,login,password,birthdate,street,city,country
FROM Users
WHERE age >= @param1
AND login = @param2
AND created <= @param3"
instead of "
var result = Users.Where(age >= 30 && login = UserLogin && created >= Datetime.Now(-30)).AsList();"
? Don't you feel you're sacrificing something?
Portability is always the first reason that comes up for using an ORM, and I wonder how often switching DB vendors actually happens in the real world.
Also, when using Dapper you really don't need those DECLAREs as it infers them from the values you pass in.
Lastly, your own example shows the cost of the ORM convenience. For instance, say you only need ID and Name for populating a drop-down list, an ORM will select each and every column in the table, whereas in SQL you can SELECT ID, Name.