khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

#EFCore users, how do you feel about using #dotnet 8 C# language features instead of DataAnnotation attributes?

On the one hand, I like that it reduces noise. On the other hand, you will likely have a mix of attributes and C# language features, which can lead to mental context switching.

Thoughts?

flensrocker,

@khalidabuhakmeh +1 for IEntityTypeConfiguration from me.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@flensrocker Yes, +1 for me too. I just forgot about it. I’m sorry folks. I let you down. 😭

joaofbantunes,
@joaofbantunes@mastodon.social avatar

@khalidabuhakmeh I haven't used attributes with EF Core in years. I rely on either language features or fluent configuration.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@joaofbantunes Attributes typically work better for teams, as you don’t have everyone changing the same method all at the same time. I mean… unless you love chaos.

Fire This Is Fine GIF

joaofbantunes,
@joaofbantunes@mastodon.social avatar

@khalidabuhakmeh why would everyone be changing the configuration for an entity at the same time? 🙂

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@joaofbantunes In my past life, folks are adding different tables, adding columns, or even dropping columns.

It’s not the same entity, but if we were using the OnModelCreating to use the fluent interface, then it would be a mess.

joaofbantunes,
@joaofbantunes@mastodon.social avatar

@khalidabuhakmeh IEntityTypeConfiguration is your friend, or in this case, my friend 😅

joaofbantunes,
@joaofbantunes@mastodon.social avatar
khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@joaofbantunes Oh right… I forgot about those Configurations. 😅

bytefish,

@khalidabuhakmeh It’s not aesthetically pleasing, but I don’t mind it. We could probably use buddy classes in a very distant future to separate both: https://github.com/dotnet/efcore/issues/14544

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@bytefish That would be kind of nice.

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