Magnus Mårtensson
Microsoft Regional Director, Azure MVP, CEO Loftysoft
Avirag Jain
Director & CTO R Systems
Mahesh Chand
Founder C# Corner, CEO Mindcracker
Chris Gali
CEO & Co-Founder Graphite
Subinder Khurana
Chief Architect StoryProcess, Founder NASSCOM DeepTech Club
Bryan Rishforth
Investor, Chairman Graphite
Bryn Everson
Director Biz Dev Graphite
Raj Tiwari
Digital Transformation Leader, Futurist and Visionary
Joseph Guadagno
Microsoft MVP, Lead Quicken Loans
Nikita Sachdev
Entrepreneur, Blockchain Enthusiast & Advisor, Social Media Influencer
Doug Wagner
COO & Founder Adapt Technical Group
Ritesh Modi
Architect, Senior Evangelist, Cloud Architect
Crystal Wenrick
Director Communications Mindcracker
Allen O’Neill
Microsoft MVP, Consulting Engineer/Architect
Praveen Kumar
CEO MCN Solutions
Chris Love
Founder Love2Dev, Microsoft MVP, Author
Sanjay Vyas
Microsoft Regional Director, Microsoft MVP, Founder & CEO SkillLabs Technologies
Veena Sarda
Deep Learning Consultant, Author
Sekhar Srinivasan
C# Corner MVP, Microsoft Certified Trainer, Pluralsight Author
Lalit Bansal
Founder & CEO - EIY SYS
Navdeep Garg
CEO Revinfotech
Prakash Tripathi
Tech Manager/Leader, Microsoft MVP, Blogger
Bhavna Jain
Breakthrough Consultant
Naveen Sharma
Enterprise Architect, Leadership Coach, Author
Vidya Vrat Agarwal
Principal Architect, Microsoft MVP, Author
Sheetal Agarwal
Founder Clownselors, Medical Clown, Trainer
Abhishek Kant
Founder GTM Catalyst
Vishnu Saran
Founder & CEO VoiceQube
Sandeep Soni
Founder & CEO Deccansoft, Microsoft Certified Trainer
Parveen Malik
AVP InfoSec & Vulnerability Management, Information Security Expert
Nitin Pandit
Microsoft MVP, Developer Evangelist, Author
Niloshima Srivastava
C# Corner MVP, Tech Architect, Trainer, Blogger
Bala Chirtsabesan
Senior Software Engineer at Microsoft, Author
Manoj Mittal
Sr. Technical Architect, C# Corner MVP, Author
Chandni Di
Co-Founder Voice of Slum
Vithal Wadje
Technical Lead, Microsoft MVP, Author
Shivam Ahuja
Founder SkillCircle, Business Mentor
Chervine Bhiwoo
Solution Architect, Microsoft MVP, Author
Saurabh Jain
Vice President Paytm, Founder Fun2Do Labs, Author
Vinay Solanki
Head IoT at Lenovo, Founder IoT-NCR
Anshu kumari
Founder Blockchainkids, Inventor, Trainer
Amit Singal
CEO Startup Buddy
Dev Pratap
Co-Founder & CEO Voice of Slum
Amey Vartak
Technology Consultant, Full Stack Developer, C# Corner MVP, Author
Viswanatha Swamy
Principal Software Engineer, C# Corner MVP, Author
Sanket Verma
Research Engineer @ Ballistics (Forensics) and Chair, PyData Delhi
Sourabh Somani
Lead Developer, Microsoft MVP, Author
Abhishek Mishra
Software Architect, C# Corner MVP, Author
Siddharth Vaghasia
Technical Consultant, C# Corner MVP, Blogger
Bassam Alugili
Senior Software Specialist, Database Expert
S Ravi Kumar
Solution Architect, C# Corner MVP, Author
Sundaram Subramanian
Full Stack Developer, C# Corner MVP, Speaker
Deepesh Somani
Solution Architect, Microsoft MVP, Author
Debasis Saha
Technical Project Manager, C# Corner MVP, Blogger, Author
Vipul Jain
Software Architect, C# Corner MVP, Author
Akshay Patel
Technical Architect, Microsoft Certified Trainer, C# Corner MVP, Author
Stephen Simon
RPA Developer, Evangelist, Author
Vivek Sharma
Founder Kingster636, AR/VR Specialist
Jeetendra Gund
Technical Lead, C# Corner MVP, Author
Sujal Beniwal
AI Enthusiast, Student
M Viknaraj
Microsoft MVP, Azure Architect, Author
Prasham Sabadra
Software Architect, C# Corner MVP, Trainer, Author
Aakash Maurya
Senior Developer, C# Corner MVP, Speaker
Ankit Sharma
Senior Software Engineer, C# Corner MVP, Author
Mangesh Gaherwar
Team Lead, C# Corner MVP, Author
Viral Jain
Technical Consultant, C# Corner MVP, Author
Bhasker Das
Solution Architect, Evangelist
Manish Dwivedi
Associate Project Manager
Ck Nitin
Programmer, Author
Rohit Gupta
Technical Trainer, Author
Manish Tewatia
Full-stack Marketer, UX Designer
Bhavya Gaur
Technical Illustrator
Rohit Tomar
SEO/SMO Expert
Web Track
Cloud & Data Track
Dev Track
Registration & Breakfast
Future of Desktop Apps with JS (ElectronJs)
Nitin Pandit
Building Serverless Microservices Using Microsoft Azure
Vithal Wadje
Innovating RPA: A Robot for Every Person
Stephen Simon
Managing Cloud Storage Accounts using Logic Apps
Viknaraj Manogararajah
Data visualization using Python
Sekhar Srinivasan
Going Cross platform with AR Foundation
Vivek Sharma
Keynote
Managing your Azure dependencies in ASP.NET Core apps using VS
Bala Chirtsabesan
Securing Applications on Intelligent Azure
Abhishek Mishra
Getting started with Blazor the Framework of Future
S Ravi Kumar
Lunch
Build Progressive Web Apps using Angular 9
Debasis Saha
Build and deploy to any platform using Azure DevOps
Chervine Bhiwoo
Deep Dive in Azure Service Bus
Akshay Patel
Build a Native Mobile Application using React Native and JavaScript
Joseph Guadagno
Making sense of Web Job, Web Job SDK and Functions in Azure
Prakash Tripathi
CloudFront Distribution in AWS
Viral Jain
Tea Break
Introduction to PowerBI
Aakash Maurya
Build Advanced SPFx solutions with React and Graph API
Siddharth Vaghasia
Build Business Intelligence Analyst (BIA) Skills
Sundaram Subramanian
Deep dive of Power Platform – AI BUILDER
Prasham Sabadra
Panel 1
What's new in SharePoint development
Vipul Jain
Build a SSO (Single Sign On) based Native JavaScript application with Microsoft Identity within 10 minutes
Manoj Mittal
Panel 2
Applications and working of AI
Veena Sarda
Deploying serverless API's with .Net core 3.0 on AWS & Azure
Amey Vartak
Panel 3
Blockchain with .NET Core (Ark)
Anshu Kumari
Closing Note & Prize Distribution
Dev Track
Cloud Track
Architecture Track
Emerging Tech Track
Registration & Breakfast
Creating Full-Stack Web Apps Using Server-Side Blazor
Ankit Sharma
Real time face recognition with MS Cognitive Services
Niloshima Srivastava
Building Scalable APIs with GraphQL
Jeetendra Gund
Future of development with AI and Blockchain
Navdeep Garg
Debugging Tips and Tricks with Visual Studio 2019
Joseph Guadagno
Azure Containers
Abhishek Kant
Enterprise Architecture
Naveen Sharma
Bot Framework - learn it fast and look like a boss!
Allen O’Neill
Keynote
.Net Core & C# 8 Performance
David McCarter
Working with Azure kubernetes services
Ritesh Modi
Becoming an Architect
Vidyavrat Agarwal
Why Techies Need to Learn Product Management
Saurabh Jain
Lunch
Build a rules engine in .Net Core
Sanjay Vyas
Building CI and CD Pipeline using Azure DevOps
Sandeep Soni
Entity Framework Core - Tips and Tricks, Performance Optimization, and Tuning
Bassam Alugili
Hacking your way into Data Science
Sanket Verma
Speed up your .Net Core Website
Sourabh Somani
Azure
Magnus Mårtensson
Demystifying Open Distro for Elasticsearch
Suman Debnath
Future of Data
Shivam Ahuja
Tea Break
gRPC with C# and .Net Core
Mangesh Gaherwar
Panel 1
Essentials of Cloud security
Parveen Malik
Power platform and Dynamics 365
Deepesh Somani
Microservices - the gRPC Way
Viswanatha Swamy
Panel 2
Reserved
Reserved
Closing Note & Prize Distribution
Creating a reusable validation pipeline with MediatR
Creating a reusable validation pipeline with FluentValidation and MediatR gives .NET teams one consistent gate between an incoming request and business logic. Instead of scattering checks across controllers, endpoints, command handlers and consumers, developers express rules as validators and let a mediator pipeline run them before the handler. That arrangement suits the C# Corner Annual Conference 2020 audience, where sessions on C#, cloud, web and messaging often address connected concerns.
The goal is not to turn every business rule into a field check. Required fields, string lengths, ranges and formats suit validation well; cross-entity rules such as uniqueness usually belong to the domain or database. A robust pipeline also needs a stable failure contract, support for asynchronous rules, cancellation, and registration that works for an ASP.NET Core API, worker or message consumer.
Australian teams gain from a shared contract when people work across Sydney, Melbourne, Brisbane and Perth. Perth usually sits three hours behind the eastern states, subject to daylight saving, so an arvo handover can expose inconsistent local checks. Customer-facing messages should use Australian spelling such as “authorisation” and “organisation”, while C# names such as ValidationBehavior follow established framework conventions. Privacy Act 1988 and the Australian Privacy Principles also make careful error payloads and logging essential.
| Concern | FluentValidation with MediatR | Data annotations | Checks inside handlers |
|---|---|---|---|
| Rule ownership | Validators are separate from controllers and handlers | Rules sit on shared or request models | Logic is mixed with each use case |
| Reuse | The same validator serves APIs, workers and consumers | Useful for simple model binding | Must be copied or extracted repeatedly |
| Failure timing | A mediator behavior rejects requests before the handler | Usually runs during model binding | Runs after business logic has started |
| Complex rules | Fluent rules, custom validators and async checks | Limited without custom attributes | Flexible, but difficult to test and reuse |
Put validation before business logic
MediatR keeps a command or query separate from the class that handles it. A request such as CreateCustomerRequest carries the input, while CreateCustomerHandler performs the use case. A generic validation behavior sits between them, locates every IValidator<TRequest>, evaluates those validators and stops the chain when errors exist. The handler therefore receives a request that has already met its input contract.
Using the MediatR API available for the 2020 event, the core of the behavior is small and transport-independent:
public sealed class ValidationBehavior<TRequest, TResponse> :
IPipelineBehavior<TRequest, TResponse>
where TRequest : notnull
{
private readonly IEnumerable<IValidator<TRequest>> _validators;
public ValidationBehavior(IEnumerable<IValidator<TRequest>> validators)
=> _validators = validators;
public async Task<TResponse> Handle(
TRequest request,
CancellationToken cancellationToken,
RequestHandlerDelegate<TResponse> next)
{
var context = new ValidationContext<TRequest>(request);
var results = await Task.WhenAll(
_validators.Select(v =>
v.ValidateAsync(context, cancellationToken)));
var failures = results
.SelectMany(r => r.Errors)
.ToList();
if (failures.Count > 0)
throw new ValidationException(failures);
return await next();
}
}
Throwing a FluentValidation exception is useful inside the application layer because it avoids coupling reusable code to HTTP. A boundary component can translate it into an ASP.NET Core ValidationProblemDetails response, or a messaging adapter can record it as a rejected message. MediatR executes behaviors in registration order, so register validation ahead of behaviors that open transactions, publish events or make costly remote calls. That ordering ensures invalid input cannot trigger those side effects.
Design validators that work beyond HTTP
A validator should describe the shape and entry constraints of one request. This keeps it understandable to developers and useful to automated tests:
public sealed class CreateCustomerValidator
: AbstractValidator<CreateCustomerRequest>
{
public CreateCustomerValidator()
{
RuleFor(x => x.Name)
.NotEmpty()
.MaximumLength(120);
RuleFor(x => x.Email)
.NotEmpty()
.EmailAddress()
.MaximumLength(254);
RuleFor(x => x.Postcode)
.Matches("^[0-9]{4}$")
.WithMessage("Postcode must contain four digits.");
}
}
Validators compose well. A CustomerAddressValidator can be invoked from a customer validator, while custom rules can format currency, parse reference values or call an external service. Because FluentValidation does not depend on MVC, the same IValidator<TRequest> can run inside a MediatR behavior regardless of whether the request arrived through an endpoint or a queue. This is particularly valuable when a service moves a workload between a public API, an Azure-hosted worker and a scheduled integration without rewriting its rules.
Keep service-backed checks deliberate. A postcode lookup or customer-reference query may need IValidator<TRequest> with MustAsync, but every call adds latency, a network dependency and possible rate limits. Use cached reference data where suitable, pass the cancellation token and avoid querying for rules that the database must enforce anyway. Uniqueness is a good example: checking whether an email already exists before insertion creates a race, so the handler and a unique database index must provide the final guarantee. State codes such as ACT, NSW, NT, QLD, SA, TAS, VIC and WA can be validated locally, while authoritative postcode relationships belong in maintained reference data or a domain service.
Register the pipeline once
Dependency injection keeps registration visible and prevents each transport from assembling its own validation chain. A typical setup scans the application assembly for validators and MediatR handlers, then registers the open generic behavior:
services.AddValidatorsFromAssemblyContaining<CreateCustomerValidator>();
services.AddMediatR(typeof(CreateCustomerRequest).Assembly);
services.AddTransient(
typeof(IPipelineBehavior<,>),
typeof(ValidationBehavior<,>));
Depending on the MediatR package version, teams may use AddMediatR with a configuration delegate instead of the assembly argument. The important point is the shape: validators are discovered through IValidator<T>, and one behavior applies to all requests that need validation. A request without a validator can still pass because the dependency resolves to an empty collection; add a startup guard or marker interface if every command must have explicit input rules.
Place validation before transaction, retry and caching behaviors whose ordering matters. A common sequence is authentication context, validation, transaction, then the handler, although the correct order depends on the application. ASP.NET Core can add request validation through MVC or minimal APIs, yet the mediator behavior remains necessary for commands dispatched internally or consumed from a message broker. This avoids the common drift where an HTTP endpoint checks one set of rules while a background consumer checks a slightly different set.
Parallel evaluation is appropriate for independent validators, and Task.WhenAll evaluates them concurrently under the request’s cancellation scope. Avoid making a network call from every rule, and keep slow lookups out of the common path. For Australian deployments using Microsoft Azure, teams can place suitable workloads in the Australia East or Australia Southeast regions, then confirm that each dependent service supports the selected region; choosing a nearby region does not by itself guarantee residency for every piece of data.
Make failures predictable at each boundary
A pipeline is only useful if callers receive a consistent error shape. For an API, map ValidationException to HTTP 400 and return ValidationProblemDetails, with an errors collection keyed by request property. Include safe, human-readable messages, and use a correlation identifier for support conversations. A malformed JSON payload, a failed validation rule and a domain conflict are different conditions, so avoid folding all of them into one generic “bad request” response.
Transport-specific handling belongs at the edge. In a message consumer, a validation failure is normally not retryable because the payload will not become valid by trying again. Publish it to a dead-letter path with a reason code, or store it for correction, according to the business workflow. A transient database timeout is different and may justify retry with backoff. Keeping these decisions outside the behavior means the core validation remains usable by APIs, schedulers and queue processors.
Security and privacy deserve special attention. Do not return stack traces, validator internals or sensitive field values in an error response, and avoid logging full request objects by default. Australian financial, health and government workloads may also be subject to sector-specific obligations beyond the Privacy Act and Australian Privacy Principles. Apply data minimisation, redaction and retention rules to logs before releasing them to a managed observability platform, and keep business identifiers in secured operational tooling rather than user-facing error messages.
Test the contract and keep it maintainable
Start with fast unit tests for each validator, covering boundaries as well as obvious examples. For CreateCustomerRequest, that means empty values, an overlong name, malformed email addresses, and postcodes that are not four digits. Parameterised test cases keep the suite compact and make a rule change visible. These tests prove the rule itself; they do not prove that MediatR invokes it.
Integration tests should exercise the real registration and a representative request. Use WebApplicationFactory for an API or instantiate the service collection directly for a worker, then assert that an invalid request returns the expected problem details and that the handler is never called. Add a success-path test to confirm that validation does not consume or mutate the request, a multi-validator test to confirm that all failures are aggregated, and a cancellation test for slow rules. Mocking the handler’s side effects is useful, but testing the composition catches missing registrations and incorrect behavior ordering.
Treat the pipeline as an architectural boundary in code review. New commands should receive a validator when they accept external input, transport-specific endpoints should dispatch through MediatR rather than bypassing it, and failure mapping should remain at the edge. Telemetry can count validation failures by request type and error code without recording rejected payloads, giving teams a useful signal without collecting unnecessary personal information. A tested, centrally registered pipeline then becomes a dependable application guarantee rather than a convention that each developer has to remember.
1, CBD, Maharaj Surajmal Road, Near Yamuna Sports Complex, Delhi, 110032
GENERAL QUERIES
Manish Tewatia
manish@csharpcon.com
+91-9718-431-042
TICKET QUERIES
Atul Gupta
conference@csharpcon.com
+91-9910-125-804