Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. Here's why:โ€ฆ (2024)

Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ

Senior .NET Developer with skills in (.NET Core, 5, 6, 7, 8 Web API's, MVC, Azure Cloud, SignalR, JavaScript, jQuery, Angular)

  • Report this post

Prefer using extension methods over AutoMapper. Here's why: ๐—ฆ๐—ถ๐—บ๐—ฝ๐—น๐—ถ๐—ฐ๐—ถ๐˜๐˜†: Write what you need, and only what you need. Extension methods allow for precise mapping without additional configuration overhead. ๐—ฃ๐—ฒ๐—ฟ๐—ณ๐—ผ๐—ฟ๐—บ๐—ฎ๐—ป๐—ฐ๐—ฒ: No reflection, no hidden costs. Direct mapping ensures optimal runtime performance, saving precious milliseconds. ๐—ฅ๐—ฒ๐—ฎ๐—ฑ๐—ฎ๐—ฏ๐—ถ๐—น๐—ถ๐˜๐˜†: Code tells a story. When someone else reads your mapping, extension methods can be more explicit, eliminating guesswork about what gets mapped where. ๐—™๐—น๐—ฒ๐˜…๐—ถ๐—ฏ๐—ถ๐—น๐—ถ๐˜๐˜†: It's your code. Tailor mapping logic to specific scenarios without being constrained by a library's limitations. ๐——๐—ฒ๐—ฏ๐˜‚๐—ด๐—ด๐—ถ๐—ป๐—ด: Step directly into your mapping code. No more complex debugging through AutoMapper's internals. While AutoMapper is an incredible library with robust features, sometimes the most straightforward solutions can offer more clarity and efficiency. ๐—ฅ๐—ฒ๐—บ๐—ฒ๐—บ๐—ฏ๐—ฒ๐—ฟ: Choose the right tool for the right job. And keep it simple!Join WhatsApp Group of .NET Developershttps://lnkd.in/dUXf4K_5Like๐Ÿ‘ & Repost โ™ป๏ธ

  • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. Here's why:โ€ฆ (2)

24

4 Comments

Like Comment

Akif Aziz

Asp.Net || .Net Core || .Net || C# || MSSQL || Javascript || Knockout.js || D3.js || PostgreSQL || Micro Services || JIRA || GIT || Azure (functions, App Services)

2d

  • Report this comment

So you took my comment suggestion and tweaked it a bit. That's great.It would be awesome if you make a more readable function than just "Map". Cause one RequestDto could map data to many entities.

Like Reply

1Reaction

Ghulam Murtaza

Full Stack Engineer at e-strats || .Net Core || Asp.Net MVC || JavaScript || SQL Server || React js

2d

  • Report this comment

useful

Like Reply

1Reaction 2Reactions

See more comments

To view or add a comment, sign in

More Relevant Posts

    • Report this post

    What is your thoughts on this topic, please write down your thoughts in the comment section.Join WhatsApp Group of .NET Developershttps://lnkd.in/dUXf4K_5Like๐Ÿ‘ & Repost โ™ป๏ธ

    This content isnโ€™t available here

    Access this content and more in the LinkedIn app

    7

    6 Comments

    Like Comment

    To view or add a comment, sign in

  • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ

    Senior .NET Developer with skills in (.NET Core, 5, 6, 7, 8 Web API's, MVC, Azure Cloud, SignalR, JavaScript, jQuery, Angular)

    • Report this post

    ๐–๐š๐ซ๐ฉ ๐ฅ๐จ๐ง๐  ๐ฐ๐จ๐ซ๐๐ฌ ๐ข๐ง ๐ฒ๐จ๐ฎ๐ซ ๐ฏ๐ข๐ฌ๐ฎ๐š๐ฅ ๐ฌ๐ญ๐ฎ๐๐ข๐จ.When any text runs off the side of the screen, the Toggle Word Warp feature of Visual Studio Code consolidates it within the window and formats it perfectly.To set word wrap preferences1) On the Visual Studio menu bar, selectTools>Options.2) SelectText Editor>All Languages>Generalto set this option globally.Join WhatsApp Group of .NET Developershttps://lnkd.in/dUXf4K_5Like๐Ÿ‘ & Repost โ™ป๏ธ

    • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. Here's why:โ€ฆ (9)

    15

    2 Comments

    Like Comment

    To view or add a comment, sign in

  • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ

    Senior .NET Developer with skills in (.NET Core, 5, 6, 7, 8 Web API's, MVC, Azure Cloud, SignalR, JavaScript, jQuery, Angular)

    • Report this post

    ๐–๐ก๐š๐ญ ๐ข๐ฌ ๐ ๐ข๐ญ ๐ฌ๐ญ๐š๐ฌ๐ก๐ข๐ง๐  ๐š๐ง๐ ๐ฐ๐ก๐š๐ญ ๐ข๐ฌ ๐ญ๐ก๐ž ๐ฎ๐ฌ๐ž ๐œ๐š๐ฌ๐ž ๐จ๐Ÿ ๐ฌ๐ญ๐š๐ฌ๐ก๐ข๐ง๐ .Often, when youโ€™ve been working on part of your project, things are in a messy state and you want to switch branches for a bit to work on something else. The problem is, you donโ€™t want to do a commit of half-done work just so you can get back to this point later. The answer to this issue is thegit stashcommand.Stashing takes the dirty state of your working directoryโ€‰โ€”โ€‰that is, your modified tracked files and staged changesโ€‰โ€”โ€‰and saves it on a stack of unfinished changes that you can reapply at any time (even on a different branch).Join WhatsApp Group of .NET Developershttps://lnkd.in/dUXf4K_5Like๐Ÿ‘ & Repost โ™ป๏ธ

    • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. Here's why:โ€ฆ (13)

    28

    7 Comments

    Like Comment

    To view or add a comment, sign in

  • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ

    Senior .NET Developer with skills in (.NET Core, 5, 6, 7, 8 Web API's, MVC, Azure Cloud, SignalR, JavaScript, jQuery, Angular)

    • Report this post

    ๐’๐ญ๐จ๐ฉ ๐ƒ๐ž๐›๐ฎ๐ ๐ ๐ข๐ง๐  ๐š๐ง๐ ๐’๐ญ๐š๐ซ๐ญ ๐‘๐ฎ๐ง๐ง๐ข๐ง๐  ๐ข๐ง ๐•๐ข๐ฌ๐ฎ๐š๐ฅ ๐’๐ญ๐ฎ๐๐ข๐จWe're all used to pressing F5 to run our solutions in Visual Studio. However, there's a potential gotcha! The default behavior with F5 is actually "๐ƒ๐ž๐›๐ฎ๐ ". This means Visual Studio launches the debugger, which can significantly slow down the startup process.The faster alternative is "๐’๐ญ๐š๐ซ๐ญ ๐ฐ๐ข๐ญ๐ก๐จ๐ฎ๐ญ ๐ƒ๐ž๐›๐ฎ๐ ๐ ๐ข๐ง๐ " (known as "Run"). In Visual Studio, you can access this with the hollow Play icon on the toolbar or by using the keyboard shortcut Ctrl+F5.๐–๐ก๐ข๐œ๐ก ๐ฆ๐ž๐ญ๐ก๐จ๐ ๐๐จ ๐ฒ๐จ๐ฎ ๐ฎ๐ฌ๐ž ๐›๐ฒ ๐๐ž๐Ÿ๐š๐ฎ๐ฅ๐ญ?If you're a habitual F5 user, give Ctrl+F5 (hollow Play) a try with your main application. Let me know in the comments if you notice a difference in startup speed!Join WhatsApp Group of .NET Developershttps://lnkd.in/dUXf4K_5Like๐Ÿ‘ & Repost โ™ป๏ธ

    • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. Here's why:โ€ฆ (18)

    26

    4 Comments

    Like Comment

    To view or add a comment, sign in

  • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ

    Senior .NET Developer with skills in (.NET Core, 5, 6, 7, 8 Web API's, MVC, Azure Cloud, SignalR, JavaScript, jQuery, Angular)

    • Report this post

    A .gitignore file tells Git which files to ignore (not track). This keeps your project clean by excluding unnecessary files and prevents accidental commits. ๐€๐๐ ๐š .๐ ๐ข๐ญ๐ข๐ ๐ง๐จ๐ซ๐ž ๐…๐ข๐ฅ๐ž:Open your project in Visual Studio.Go to๐“๐จ๐จ๐ฅ๐ฌ > ๐Ž๐ฉ๐ญ๐ข๐จ๐ง๐ฌ > ๐’๐จ๐ฎ๐ซ๐œ๐ž ๐‚๐จ๐ง๐ญ๐ซ๐จ๐ฅ > ๐†๐ข๐ญ ๐‘๐ž๐ฉ๐จ๐ฌ๐ข๐ญ๐จ๐ซ๐ฒ ๐’๐ž๐ญ๐ญ๐ข๐ง๐ ๐ฌ.Under๐†๐ž๐ง๐ž๐ซ๐š๐ฅ, click the๐€๐๐button next to๐ˆ๐ ๐ง๐จ๐ซ๐ž ๐…๐ข๐ฅ๐ž.This creates a .gitignore file with some common defaults for .NET projects. You can further customize it by adding patterns for specific files or folders you want to exclude.Join WhatsApp Group of .NET Developershttps://lnkd.in/dUXf4K_5Like๐Ÿ‘ & Repost โ™ป๏ธ

    • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. Here's why:โ€ฆ (23)

    41

    4 Comments

    Like Comment

    To view or add a comment, sign in

  • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ

    Senior .NET Developer with skills in (.NET Core, 5, 6, 7, 8 Web API's, MVC, Azure Cloud, SignalR, JavaScript, jQuery, Angular)

    • Report this post

    ๐‡๐š๐ฏ๐ž ๐ฒ๐จ๐ฎ ๐ž๐ฏ๐ž๐ซ ๐›๐ž๐ž๐ง ๐จ๐ง ๐š ๐ฐ๐ž๐›๐ฌ๐ข๐ญ๐ž ๐ญ๐ก๐š๐ญ ๐ญ๐š๐ค๐ž๐ฌ ๐Ÿ๐จ๐ซ๐ž๐ฏ๐ž๐ซ ๐ญ๐จ ๐ฅ๐จ๐š๐ ๐š ๐ฉ๐š๐ ๐ž?It can be frustrating for users, and not great for your server either. Cancellation Token is a built-in feature in .NET that lets users cancel requests that are taking too long.๐‚๐š๐ฎ๐ญ๐ข๐จ๐ง:Utilize the CancellationToken for read-only actions that donโ€™t impact data integrity.๐’๐ฆ๐š๐ฅ๐ฅ ๐“๐ข๐ฉ:โ€œThe Roslyn Analyzer and Meziantou.Analyzer contains a rule to detect missing CancellationToken: MA0040 - Use a cancellation token when available.โ€๐‰๐จ๐ข๐ง ๐–๐ก๐š๐ญ๐ฌ๐€๐ฉ๐ฉ ๐†๐ซ๐จ๐ฎ๐ฉ ๐จ๐Ÿ .๐๐„๐“ ๐ƒ๐ž๐ฏ๐ž๐ฅ๐จ๐ฉ๐ž๐ซ๐ฌhttps://lnkd.in/dUXf4K_5Like๐Ÿ‘ & Repost โ™ป๏ธ

    • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. Here's why:โ€ฆ (28)

    27

    4 Comments

    Like Comment

    To view or add a comment, sign in

  • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ

    Senior .NET Developer with skills in (.NET Core, 5, 6, 7, 8 Web API's, MVC, Azure Cloud, SignalR, JavaScript, jQuery, Angular)

    • Report this post

    ๐Ÿ“ ๐‘๐ฎ๐ฅ๐ž๐ฌ ๐Ÿ๐จ๐ซ ๐ƒ๐“๐Ž๐ฌ1) Should not contain logic or behaviour.2) Should not enforce encapsulation. They don't need private/protected members.3) Should use properties not fields.4) Should only use "DTO" or "Dto" in their name as a last resort. Name them for how thy are used.5) These should be modelled as DTOs:- API request/response objects.- MVC viewmodel objects.- Database query result objects.- Messages (Commands, Events, Queries)Join WhatsApp Group of .NET Developershttps://lnkd.in/dUXf4K_5Like๐Ÿ‘ & Repost โ™ป๏ธ

    68

    6 Comments

    Like Comment

    To view or add a comment, sign in

  • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ

    Senior .NET Developer with skills in (.NET Core, 5, 6, 7, 8 Web API's, MVC, Azure Cloud, SignalR, JavaScript, jQuery, Angular)

    • Report this post

    ๐‡๐ž๐ซ๐ž'๐ฌ ๐ฆ๐ฒ ๐ญ๐š๐ค๐ž ๐จ๐ง ๐ฎ๐ฌ๐ข๐ง๐  ๐š ๐ฌ๐ข๐ง๐ ๐ฅ๐ž ๐๐š๐ญ๐š๐›๐š๐ฌ๐ž ๐ฏ๐ž๐ซ๐ฌ๐ฎ๐ฌ ๐ฌ๐ž๐ฉ๐š๐ซ๐š๐ญ๐ž ๐๐š๐ญ๐š๐›๐š๐ฌ๐ž๐ฌ ๐Ÿ๐จ๐ซ ๐ž๐š๐œ๐ก ๐ญ๐ž๐ง๐š๐ง๐ญ, ๐š๐Ÿ๐ญ๐ž๐ซ ๐ซ๐ž๐œ๐ž๐ข๐ฏ๐ข๐ง๐  ๐Ÿ๐ž๐ž๐๐›๐š๐œ๐ค ๐Ÿ๐ซ๐จ๐ฆ ๐ฅ๐š๐ฌ๐ญ ๐ฉ๐จ๐ฅ๐ฅ:๐Ž๐๐ˆ๐๐ˆ๐Ž๐We should only create separate databases if isolation of data is requested by a specific client; otherwise, a single database with a tenant_id is more than sufficient. Multiple databases add complexity, and we should only introduce complexity if there is no other option. Don't create multiple databases just to look fancy.Join WhatsApp Group of .NET Developershttps://lnkd.in/dUXf4K_5Like๐Ÿ‘ & Repost โ™ป๏ธ

    6

    Like Comment

    To view or add a comment, sign in

  • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ

    Senior .NET Developer with skills in (.NET Core, 5, 6, 7, 8 Web API's, MVC, Azure Cloud, SignalR, JavaScript, jQuery, Angular)

    • Report this post

    ๐๐š๐ฌ๐ž ๐‘๐ž๐ฉ๐จ๐ฌ๐ข๐ญ๐จ๐ซ๐ฒ ๐š๐ง๐ ๐ข๐ญ๐ฌ ๐”๐ฌ๐ž ๐‚๐š๐ฌ๐ž:๐๐ฎ๐ซ๐ฉ๐จ๐ฌ๐ž: A base repository acts as a foundation for your all repositories. It defines common functionality and context that can be reused across various repositories in your application.๐๐ž๐ง๐ž๐Ÿ๐ข๐ญ:๐‘๐ž๐๐ฎ๐œ๐ž๐ ๐‚๐จ๐๐ž ๐ƒ๐ฎ๐ฉ๐ฅ๐ข๐œ๐š๐ญ๐ข๐จ๐ง: Base repositories eliminate the need of repetitive private read only properties for dbContext in your all repositories. You can also put common logic inside BaseRepository if you have any.๐‡๐จ๐ฐ ๐ญ๐จ ๐”๐ฌ๐ž ๐๐š๐ฌ๐ž ๐‘๐ž๐ฉ๐จ๐ฌ๐ข๐ญ๐จ๐ซ๐ฒ:Just inherit your repository from BaseRepository and that's it now you can access the functionalities of BaseRepository inside your specific repository.Join WhatsApp Group of .NET Developershttps://lnkd.in/dUXf4K_5Like๐Ÿ‘ & Repost โ™ป๏ธ

    • Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. Here's why:โ€ฆ (37)

    66

    10 Comments

    Like Comment

    To view or add a comment, sign in

Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. Here's why:โ€ฆ (41)

Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. Here's why:โ€ฆ (42)

8,484 followers

  • 528 Posts

View Profile

Follow

Explore topics

  • Sales
  • Marketing
  • Business Administration
  • HR Management
  • Content Management
  • Engineering
  • Soft Skills
  • See All
Nouman Baloch ๐Ÿ‡ต๐Ÿ‡ธ on LinkedIn: Prefer using extension methods over AutoMapper. 
 
Here's why:โ€ฆ (2024)
Top Articles
Latest Posts
Article information

Author: Fredrick Kertzmann

Last Updated:

Views: 5981

Rating: 4.6 / 5 (66 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Fredrick Kertzmann

Birthday: 2000-04-29

Address: Apt. 203 613 Huels Gateway, Ralphtown, LA 40204

Phone: +2135150832870

Job: Regional Design Producer

Hobby: Nordic skating, Lacemaking, Mountain biking, Rowing, Gardening, Water sports, role-playing games

Introduction: My name is Fredrick Kertzmann, I am a gleaming, encouraging, inexpensive, thankful, tender, quaint, precious person who loves writing and wants to share my knowledge and understanding with you.