khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

Join Chris Klug and me today on our latest Livestream. I think this is a spicy 🌶️ take, and I’m curious how many folks agree or disagree with the guest regarding #dotnet #entityframework?

"Stop using Entity Framework as a DTO provider!”

https://www.youtube.com/watch?v=N_eLotlcjXo

xoofx,
@xoofx@mastodon.social avatar

@khalidabuhakmeh Agree, though, I would believe that what Chris is describing with his wrapper over DTO is closer to the more conventional concept of a "ViewModel" over "Model", or am I missing something? A ViewModel doesn't have to be solely designed for an UI scenario, it can be designed for e.g higher level Web API

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@xoofx Honestly, I liked Chris’ style way more than I thought I would. He made some great points and, as an EF power user, gave good advice regardless of the approach folks end up choosing.

I see how it matches ViewModels, but there are some slight differences. The biggest is that relationship logic and “connections” are internal to the objects. With ViewModels, it’s more about tailoring the data for consumption, whereas his approach seemed to be about building a useable API surface.

range_marten,
@range_marten@dotnet.social avatar

@khalidabuhakmeh we "threw out" EF because of perceived startup perf.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@range_marten Depends what version you’re talking about I guess. Newer versions are pretty good. Most issues I see with EF stem from pulling too much or too little data at a time.

range_marten,
@range_marten@dotnet.social avatar

@khalidabuhakmeh it was 2 years ago or so. It was not the query time per se but rather the startup of the app service. IIRC it had to do with checking schema.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@range_marten Yeah, EF uses a model schema to help with change tracking. The first instantiation of the DbContext can stutter a bit, but it is not enough to make me throw it out. It depends on the size of the context.

There’s also ways to precompile and cache it, so… yeah.

range_marten,
@range_marten@dotnet.social avatar

@khalidabuhakmeh yes and it got too complicated for us and thus we don't use it anymore. But if it works for you then you should use it.

range_marten,
@range_marten@dotnet.social avatar

@khalidabuhakmeh hope my takes are not too spicy :)

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar
popalex,

@khalidabuhakmeh Interesting....

  • All
  • Subscribed
  • Moderated
  • Favorites
  • dotnet
  • DreamBathrooms
  • ngwrru68w68
  • modclub
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • GTA5RPClips
  • provamag3
  • ethstaker
  • normalnudes
  • tester
  • osvaldo12
  • everett
  • cubers
  • tacticalgear
  • anitta
  • megavids
  • Leos
  • cisconetworking
  • JUstTest
  • lostlight
  • All magazines