Generate viral LinkedIn posts in your style for free.

Generate LinkedIn posts
Milan Jovanović

Milan Jovanović

These are the best posts from Milan Jovanović.

19 viral posts with 5,877 likes, 442 comments, and 556 shares.
14 image posts, 0 carousel posts, 0 video posts, 0 text posts.

👉 Go deeper on Milan Jovanović's LinkedIn with the ContentIn Chrome extension 👈

Best Posts by Milan Jovanović on LinkedIn

One small change = 400x FASTER query

Here's what I did to achieve this performance boost.

I was implementing cursor pagination with EF and Postgres.

But I need to make the query faster.

How do you make an SQL query faster?

Add an index, and you're good to go.

Right?

Not quite...

I created a composite index on the required columns to speed up the query.

BUT THIS MADE THE QUERY SLOWER!!!

This led me down a rabbit hole to figure out why the index wasn't used.

I knew about tuple comparison from before, and this solved the problem.

But I didn't know how to translate this into an EF Core query.

Luckily, the Postgres provider supports this with a custom function.

Here's everything you should know: https://lnkd.in/eD629U-B

---
Sign up for the .NET Weekly with 74K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/e-XH7dM7
Multiple EF Core DbContexts in a single application?

Here's when it makes sense to do this:

- Working with multiple databases
- Separating concerns
- Modular monolith
- Read replicas

I did this when implementing a modular monolith application.

Each module had a dedicated schema in the database and a separate DbContext in the code.

The surprising part?

How EF Core deals with database migrations and different schemas.

Here's a breakdown of how I solved this: https://lnkd.in/e6JWgpNv

Did you need to use multiple DbContexts with EF?

---
Sign up for the .NET Weekly with 74K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/eDqzAKsP
Post image by Milan Jovanović
Do you know all 3 ways to define Middleware in ASP .NET Core?

Middleware allows you to introduce additional logic before or after executing an HTTP request.

Middleware is an excellent choice for solving cross-cutting concerns in your application.

You are already using many of the built-in middleware available in the framework.

I'm going to show you three approaches to define custom middleware:

- Request Delegates
- Convention based
- Factory based

Here's everything you need to know: https://lnkd.in/eHYAh7Pc

How do you prefer to define middleware in .NET?
Post image by Milan Jovanović
If your .NET app runs background jobs or distributed workers, you need a way to prevent duplicate execution.

Otherwise, two instances can pick up the same task: sending duplicate emails, charging twice, or overwriting data.

That’s where distributed locking comes in.

In my latest video, I show how to implement production-ready distributed locks in .NET using a single clean library.

You’ll see how to:
- Use Postgres advisory locks and Redis for distributed coordination
- Build a reusable locking abstraction for any .NET app
- Decide when it actually makes sense to use one

If you care about reliability and data integrity, this one’s worth your time.

Learn more: https://lnkd.in/eWfVWmHk
Post image by Milan Jovanović
What's wrong with the first code snippet?

The second example is 43x faster to insert 10,000 records.

But what causes such a huge performance difference?

If you understand how EF works under the hood, the answer should be obvious. 👇

Every call to SaveChanges means one round-trip to the database.

In the first example, inserting each record means one call to the database.

This quickly adds up...

Here's why it's important to use the right tool for the job: https://lnkd.in/eStH9yku

Sending unnecessary queries to the database is one of the biggest performance killers in enterprise applications.

---
Sign up for the .NET Weekly with 74K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/eDqzAKsP
Post image by Milan Jovanović
Does your application need input validation?

There's a 99% chance the answer is YES.

Don't reinvent the wheel - use FluentValidation.

FluentValidation gives you a simple API to build complex validation rules.

You can write rules to ensure values are:
- Not null
- Not empty
- Have a min/max length
- Are equal/not equal to some value
- Define your completely custom rules

It's easy to write asynchronous validation rules using the MustAsync method. Dependency injection also works as you'd expect.

Here's how you can use FluentValidation to build a global validation middleware in minutes: https://lnkd.in/eKa6XVrT

Have you used FluentValidation before?

---
Sign up for the .NET Weekly with 74K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/e-XH7dM7
Group related concepts together = build better applications 💡

Another name for this is cohesion, where we want to maximize the "relatedness" of files for a single feature.

Layered architectures typically have low cohesion.

The problem?

They force you to make changes in many different layers to implement or update a feature.

Vertical slices take a different approach.

All the files for a single use case are grouped together, which increases their cohesion. It's easy to find all the relevant components for a feature.

You can learn more about VSA here: https://lnkd.in/e-TKtnay

What do you think about this approach?

---
Sign up for the .NET Weekly with 74K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/eDqzAKsP
Post image by Milan Jovanović
When I need to add a real-time feature to my app, there's one trusted solution I always go back to.

→ SignalR

SignalR allows you to add real-time functionality to your .NET applications.

And it all starts from a Hub. The Hub is a central component in your application that manages client connections and messaging.

Clients connect to the Hub to receive and send messages. Which means the communication is two-way.

SignalR abstracts away the transport mechanism from you. Usually this will be WebSockets, but if they're not available, it can fall back to SSE or polling.

Here's how you can get started: https://lnkd.in/ecnHcStj

SignalR is easily one of the best tools we have in .NET.

---
Sign up for the .NET Weekly with 74K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/e-XH7dM7
Post image by Milan Jovanović
Starting from an existing database doesn’t mean you can’t use EF Core effectively.

Most .NET tutorials focus on Code-First.

But in the real world, many teams inherit a schema, and you still need a clean, maintainable way to work with it.

In my latest video, I show how to scaffold a DbContext from an existing PostgreSQL database using EF Core and .NET Aspire.

You’ll learn how to:
- Reverse-engineer your database with Scaffold-DbContext
- Configure it with Aspire’s connection management
- Avoid pitfalls like returning entities directly
- And evolve your setup into a Code-First workflow when your app grows

If you’ve ever had to start from a database instead of code, this one’s for you.

Learn more: https://lnkd.in/edBy4a77
Post image by Milan Jovanović
If you're still writing five separate interfaces and classes for every single command in .NET, you need to see this.

For years, many of us in the .NET community have relied on MediatR and MassTransit for command handling and messaging. But the boilerplate is real.

I finally took the plunge and explored Wolverine, a library that claims to be the "next generation" of .NET messaging by focusing on convention over configuration.

In my new video, I share my raw, first-take as a long-time user of other messaging tools: https://lnkd.in/eDm9Aa3p
Post image by Milan Jovanović
How do you create background jobs in .NET?

With Quartz, it's as simple as implementing an interface.

You define a job, register it, and Quartz takes care of scheduling and execution for you.

It integrates beautifully with dependency injection, so you can inject any services you need, from logging to your repositories.

Jobs are scoped, meaning you can even inject a DbContext safely without worrying about lifetime issues.

Once you start using Quartz, it’s hard to go back to manual background loops or timers.

I wrote an advanced guide for working with Quartz in .NET that I think you’ll enjoy.

You can read it here: https://lnkd.in/eNjF_jXE

Have you tried Quartz before, or do you use another library for background jobs?

---
Sign up for the .NET Weekly with 74K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/eDqzAKsP
Post image by Milan Jovanović
System integration testing changed how I test my applications.

Have you heard about it?

This type of test gives you the highest level of confidence.

Let's take a modular monolith and test the integration between modules.

A modular monolith consists of multiple modules (duh), each with a distinct responsibility. Modules represent high-level components with well-defined boundaries.

The modules essentially group together related functionalities (use cases).

What's the best way to test module interactions?

System integration testing (SIT) is an approach to verifying the collaboration of these modules.

During system integration testing, we want to ensure that all these modules interact correctly and fulfill our system's business requirements.

Here's a hypothetical scenario:

- A user registers with our application through the Users Module
- The Users Module publishes an integration event to notify other modules
- The Ticketing Module handles the event and creates a customer record

How would you write a test for this scenario?

If you want to learn more about system integration testing, I wrote a high-level guide.

Read it here: https://lnkd.in/esyaQ6SG

What do you think about this testing approach?

---
Sign up for the .NET Weekly with 74K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/eDqzAKsP
Async messaging is one of the best ways to make your .NET systems faster and more reliable.

Instead of services waiting on each other, you send messages through a broker.

In my new video, I'll show you how to build async messaging in .NET using Azure Service Bus step by step:

✅ Queues vs. Topics (when to use which)
✅ Message processing and dead-lettering
✅ Subscriptions and filters
✅ Scheduling and deduplication
✅ Full demo with .NET + Aspire

If you've been curious about event-driven design or scaling your services, this video will give you a solid foundation.

Watch here: https://lnkd.in/eN6FVAEc
Post image by Milan Jovanović
The .sln file as we know it is finally dead.

After nearly two decades of dealing with unreadable GUIDs and painful merge conflicts, Visual Studio 2026 has introduced the new .slnx format. It’s clean, it’s XML-based, and it actually makes sense.

But that’s not the only upgrade.

In my latest video, I show you how I moved my entire solution from .NET 9 to .NET 10 in just a few minutes.

The secret isn't upgrading every project manually, it’s using a "Smart Setup" with Directory.Build.props and Central Package Management.

In this video, I break down:

- How to change target frameworks for 20+ projects instantly
- Managing NuGet versions in one single file
- A deep dive into the new .slnx format (and how to migrate)
- Handling Dockerfile updates for .NET 10

Stop fighting with your solution files.

Here is the better way to handle the upgrade: https://lnkd.in/dFgdarZe
Post image by Milan Jovanović
6 things I do to set up my new .NET projects the right way

1. Enforce a consistent code style
2. Centralize build configuration
3. Centralize package management
4. Add static code analysis
5. Set up local orchestration
6. Automate builds with CI

I wrote a step-by-step guide on how to configure all this here: https://lnkd.in/eCpE6KM3

What else would you add to this project setup?

I already know a few people will say tests.

Definitely integration testing with something like Testcontainers.

---
Sign up for the .NET Weekly with 74K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/ew5Adz89
Stop polling your database.

Let Postgres tell you when something changes.

In my latest video, I show how to stream Postgres Write-Ahead Log (WAL) changes directly into your .NET app using Npgsql.

You’ll learn how to:
- Set up logical replication in Postgres
- Stream changes in real time with Npgsql
- React to inserts, updates, and deletes
- Implement cache warming, cache invalidation, or even Outbox publishing

Watch it here: https://lnkd.in/e8iveVDD

If you’ve ever built a cache layer or event-driven system in .NET, this one will spark ideas.
Post image by Milan Jovanović
Clean code tip:

- Merge nested IF statements into one condition

I often make this simple change to improve code readability.

Clean code principles will make you a better developer.

But what is clean code in the first place?

Clean code is code that's:

- Easy to read
- Easy to maintain
- Easy to understand

Writing clean code is a skill.

It's a skill you can learn and improve with practice.

In the initial example:

- Nesting increases complexity
- Nesting makes the code harder to reason about

The solution is to combine the nested IF statements into a single IF.

Three ways you can do this:

- Write an inline boolean expression
- Expose a method with the expression
- Create a variable with the expression

But this is just the start.

Here are 8 more clean code tips: https://lnkd.in/dt84mr9J

Which solution do you like better?

---
Sign up for the .NET Weekly with 75K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/ej4nP9pY
Post image by Milan Jovanović
.NET 10 is officially released! 🎉

Here are the top updates 👇

First, .NET 10 is an LTS (long-term support) release. So we get support for the next 3 years.

🔥 Performance improvements

Under the hood, .NET 10 delivers major performance boosts. The JIT compiler has been tuned with new optimizations such as de‑abstraction, smarter inlining heuristics and constant‑folding, allowing the runtime to do more work at compile‑time rather than at run‑time. There are many other optimizations across collections and LINQ, which translate to tangible speedups across everyday workloads.

🚀 Aspire goes polyglot

Formerly .NET Aspire, Aspire is now a polyglot, developer‑first platform for orchestrating front ends, APIs, containers and databases. Version 9.5 introduces a preview of a single‑file AppHost, letting you define and run your entire distributed application in a single file. The release also debuts a Generative AI visualizer to inspect and debug prompts and responses, plus expanded AI support with typed clients for GitHub Models and Azure AI Foundry and first‑class OpenAI integration.

🔗 EF Core’s new LeftJoin/RightJoin operators

LINQ’s lack of a built‑in outer join has long been a pain point. EF Core 10 fixes this by adding LeftJoin and RightJoin operators, so the code now reads exactly like the SQL you intend. For example, you can join products to reviews using LeftJoin() and EF will generate the correct LEFT JOIN statement under the hood. A corresponding RightJoin() keeps all rows from the right side while bringing in matches from the left. These new operators eliminate the verbose GroupJoin + DefaultIfEmpty pattern and make LINQ queries easier to read and maintain.

What's your favorite feature coming in .NET 10?

---
Sign up for the .NET Weekly with 74K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/e3q7Nu4s
Refit - a game-changer API client

I've spent many hours working with external APIs.

It's a crucial part of modern software development.

But let's be honest - it can be a real pain sometimes.

We've all been there:

- Configuring HttpClient for each API
- Writing repetitive code
- Hoping we didn't miss a parameter somewhere

That's why I want to introduce you to Refit.

It's a library that will help you build API integrations faster.

It handles all the HTTP heavy lifting. You focus on what matters: your application logic.

Here's everything you need to know about Refit: https://lnkd.in/d8XrVMwS

Did you ever work with Refit in your applications?

---
Sign up for the .NET Weekly with 75K+ other engineers, and get a free Clean Architecture template: https://lnkd.in/edzd2tK5
Post image by Milan Jovanović

Related Influencers