'Stop Using Automapper in .NET!' - Code Cop #001

preview_player
Показать описание


Hello, everybody, I'm Nick, and in this video of LinkedIn Advice Police Department (LAPD) I will take a look at three bad pieces of advice and try to give you good advice based on them.

Don't forget to comment, like and subscribe :)

Social Media:

#csharp #dotnet
Рекомендации по теме
Комментарии
Автор

Name this series CPD, Code Police Department and it's going to take off like a rocket

simeonnov
Автор

As for automapper... I think the real issue is people add it for some use-case that makes sense, and then because it's there, they end up mapping everything they have through it, instead of just the one thing that actually needed it. Automappers destroy compile-time type safety when you use them, they should be used *extremely* sparingly, and only in cases where their test-validation can work (i.e, fully maps either input or output). If you have to define the mapping because it's not 1:1 with the same names, it's easier/faster/safer to just define those mappings in normal code, manually

Dimencia
Автор

I like these series already, as I liked the other debunk videos. A great way to explain to colleagues why not to do certain things.

fusedqyou
Автор

I love when you explain in detail why these advices are not so good, it is really helpfull especially for begginers that could get into this errors and not know the cause or how to solve them. I think this is a great idea for a series and I'm willing to watch them all, keep up the good work!

lucaszapata
Автор

I absolutely agree with each and every point you're making. 7:30 In c++ there was a time where everything had to be as unreadable as possible where single letters was used everywhere as variables. I C# it seems like its the other way around where everyting has to be spelled out and be as readable as possible. I like the middelground where the two are mixed. Like with var student = new Student(); and in plural if it's a list of a collection. In lambdas I try to use the first letter of the class or collection I'm accessing. Like with students.Where(s => s) instedet of x => x. etc etc. In a foreach I'd like to have foreach(var student in students) but have used foreach(var stud in students) as well at times.

CRBarchager
Автор

Love the series idea! Nice pointing out the “trust me bro” problem. Since we are trying to minimize the problem of trusting whatever you see on the internet ( no offense but untrained eyes don’t know if you are right either), could you reference the official documentation, which would fit the httpClient example.

dmarte
Автор

Going through the Docker course right now, excellent so far. Keep up the good work!

RichardMcKenna
Автор

Regarding AutoMapper, the creator himself has said that it was only intended to be used for simple cases, and that people often use it in complex scenarios where it shouldn't be.

The guidance, therefore, might be to only use AutoMapper when your mappings are so simple that you don't need AutoMapper.

WilliamCWayne
Автор

Good stuff Nick, especially around naming. It's really not that hard as code should read like prose, and using proper names for vars and args helps you fall into the pit of succes.

andersborum
Автор

Love your benchmarking comparisons. Would love to see more

truesoldier
Автор

I really like the video format, Nick. Keep going!
I used to see a lot of posts like these ones on LinkedIn, some trying to state things no matter the context, something like "here's the universal truth, accept it". 🥴

rennasccenth
Автор

This is a great video! And I agree with your statements here.

HackerUC
Автор

Keep it up. It was a great post and I'm waiting to watch his kind of videos again!

saeedbaninosrat
Автор

I love this, this series has so much potential

mariocamspam
Автор

Great idea, worth spreading. I was really surprised that someone else is using x in lanbdas! Super! One piece of advice only, do not mix three topics, every one deserves even a short, but separate video. Anyway, thank you very much for sharing.

GerardJaryczewski
Автор

I also use one letter in Linq for 95% of the times. Other 5 if the list or action or func is not obvious enough.

Great videos as always :)

PatricSjoeoe
Автор

The new Automapper has improved a lot and the differences are not so different. It utilizes expression chains which are precompiled and does not use reflection or expression generation at run time like in the older versions.

yonatandaniyel
Автор

I agree with you Nick! And I use automapper a lot, works for my cases..

hassejansson
Автор

Good series content! Perhaps later expand them to some antipatterns and gotchas in various scenarios!

soucianceeqdamrashti
Автор

I prefer manual mapping just because it gives me more control and, to be honest, it's faster to understand something. It's clearer, no magic, no shenanigans.

No issues with Automapper, I just prefer not to, it doesn't really make sense to me, specially with records and required properties now.

meowzhin