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
Implementing dependency injection with generic repositories in EF Core
Australian engineering teams that build on ASP.NET Core frequently reach for two patterns that travel well together: the generic repository and the built-in inversion of control container. When paired with Entity Framework Core, they decouple data access from controllers, Razor Pages, and background workers, and they make unit testing practical without reaching for brittle database fixtures. Conference attendees in Sydney and Melbourne often raise the same question: how do you wire these pieces together so that DbContext lifetimes stay correct and the architecture still holds up six months later.
The .NET ecosystem around EF Core has stabilised, and the tooling available in Visual Studio 2022 and JetBrains Rider on Australian workstations has matured to the point where the conversation has moved from "can we make it work" to "can we make it clean". Azure regions in Australia East (Sydney) and Australia Southeast (Victoria) keep SQL traffic close to the application tier, removing the latency that used to make teams hesitate before splitting services into multiple scopes.
This walkthrough covers a generic repository interface, a concrete implementation, the service registrations that respect EF Core's scoped lifetime, and the asynchronous patterns that suit Australian workloads. Along the way it touches on how the Australian Privacy Principles under the Privacy Act 1988 shape what repository methods should and should not return to callers.
Comparing DI lifetimes against EF Core requirements
Before any code is written, it is worth pausing on the lifetimes exposed by IServiceCollection. EF Core's DbContext is intentionally scoped, and any repository that wraps it must follow the same rule.
| Lifetime | When the instance is created | When it is disposed | Best fit in an EF Core app |
|---|---|---|---|
| Singleton | Once per application | Application shutdown | Stateless helpers, configuration readers, in-memory caches |
| Scoped | Once per HTTP request or scope | End of request | DbContext, repositories, unit of work |
| Transient | Each time it is requested | After the consuming object is released | Lightweight, stateless services, mappers, validators |
A singleton repository holding a scoped DbContext throws at startup. A transient repository holding a scoped context throws at runtime once the framework disposes the context mid-operation. The default Microsoft recommendation, and the one used in the rest of this article, is Scoped for any class that owns a DbContext.
Designing the generic repository interface
A repository interface should read like a contract, not a one-off facade. The shape below keeps the surface async, accepts cancellation tokens, and leaves room for entity-specific extensions through a second generic parameter.
public interface IRepository<TEntity, TKey> where TEntity : class
{
Task<TEntity?> GetByIdAsync(TKey id, CancellationToken cancellationToken = default);
Task<IReadOnlyList<TEntity>> ListAsync(
Expression<Func<TEntity, bool>>? predicate = null,
CancellationToken cancellationToken = default);
Task AddAsync(TEntity entity, CancellationToken cancellationToken = default);
void Update(TEntity entity);
void Remove(TEntity entity);
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
}
Each method accepts a CancellationToken with a default value, which means ASP.NET Core controllers can simply pass the request token through. Background services hosted in IHostedService implementations can supply their own token and react to graceful shutdown signals coming from Kubernetes or Azure Container Apps. Restricting TEntity to a reference type avoids the corner case of value-type entities that EF Core would still try to track.
The optional predicate parameter on ListAsync lets callers express simple filters directly, while complex queries still belong in dedicated query handlers or specifications. Keeping the interface narrow makes mocking trivial in unit tests with NSubstitute or Moq, which matters for teams working under APRA CPS 234 where test coverage of data access paths is part of the evidence pack.
Building the concrete implementation
The concrete class is a thin wrapper around DbContext, and intentionally so. Wrapping too much logic hides the unit of work behaviour that DbContext already provides and tempts developers to add caching layers where EF Core's change tracker would do the same job.
public class Repository<TEntity, TKey> : IRepository<TEntity, TKey>
where TEntity : class
{
private readonly DbContext _db;
private readonly DbSet<TEntity> _set;
public Repository(DbContext db)
{
_db = db;
_set = db.Set<TEntity>();
}
public Task<TEntity?> GetByIdAsync(TKey id, CancellationToken ct = default)
=> _set.FindAsync(new object[] { id! }, ct).AsTask();
public async Task<IReadOnlyList<TEntity>> ListAsync(
Expression<Func<TEntity, bool>>? predicate = null, CancellationToken ct = default)
{
var query = _set.AsNoTracking().AsQueryable();
if (predicate is not null) query = query.Where(predicate);
return await query.ToListAsync(ct);
}
public async Task AddAsync(TEntity entity, CancellationToken ct = default)
=> await _set.AddAsync(entity, ct);
public void Update(TEntity entity) => _set.Update(entity);
public void Remove(TEntity entity) => _set.Remove(entity);
public Task<int> SaveChangesAsync(CancellationToken ct = default) => _db.SaveChangesAsync(ct);
}
AsNoTracking() on read paths is a deliberate choice for query endpoints. Tracking adds memory pressure and slows down read-heavy workloads like the dashboards seen in Australian fintech and health platforms. Tracking should be opt-in, not the default. For endpoints that need to update the same entity they read, the caller can use IQueryable projections or simply call Update afterwards, which EF Core handles correctly when the entity was loaded with identity resolution.
Registering services in the ASP.NET Core container
Registration belongs in Program.cs (or Startup.cs for older projects). A small extension method keeps the surface tidy and lets feature modules register their own repositories later.
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddGenericRepositories(this IServiceCollection services)
{
services.AddScoped(typeof(IRepository<,>), typeof(Repository<,>));
return services;
}
}
The call site stays simple, and it sits in Program.cs next to the DbContext registration:
builder.Services.AddDbContext<AppDbContext>(opts =>
opts.UseSqlServer(builder.Configuration.GetConnectionString("AppDb")));
builder.Services.AddGenericRepositories();
builder.Services.AddScoped<IOrderService, OrderService>();
The order of calls only affects readability, not resolution. As long as DbContext is registered before IRepository<,>, the container walks the graph correctly. Teams running distributed systems across Australia East and Australia Southeast should keep connection strings close to the application tier to avoid the cross-region data egress fees that surface under Microsoft's pricing model. Async correctness shows up the moment the repository is consumed. A common mistake is awaiting inside Parallel.ForEachAsync without a shared CancellationToken, which leads to half-completed batches when a worker shuts down at 09:00 AEST on a Monday morning.
public async Task ProcessAsync(IEnumerable<int> ids, CancellationToken ct)
{
await Parallel.ForEachAsync(ids, new ParallelOptions
{
MaxDegreeOfParallelism = 4,
CancellationToken = ct
}, async (id, token) =>
{
var order = await _repo.GetByIdAsync(id, token);
// process order
});
}
For unit tests, the abstraction allows mocking with NSubstitute or Moq. Integration tests can swap the in-memory provider for Testcontainers running SQL Server, which mirrors the production runtime closely enough to catch provider-specific behaviour. Teams in regulated industries often pair these tests with synthetic data generators so that no real customer information ever enters a development environment, an approach that lines up with the spirit of the Notifiable Data Breaches scheme.
Compliance, auditing, and local realities
Several pieces of Australian legislation shape how repository methods are designed in practice. The Australian Privacy Principles require that personal information be collected only by fair means and that access be limited to those who need it. That principle encourages repository methods that accept authorisation filters as parameters rather than fetching whole entity graphs by default and trimming later in the controller.
APRA CPS 234 adds another layer for banks, insurers, and superannuation funds, demanding demonstrable controls around information assets and resilience to information security incidents. In code, that often translates into audit fields on every entity, repository hooks that stamp LastModifiedBy and LastModifiedUtc, and a logging pipeline that records every cross-region read against Australian-hosted SQL.
Practical habits in local teams reflect these rules. Engineers in Brisbane and Perth often add AsSplitQuery() for queries that span many optional includes, reducing the chance of cartesian explosion when audit log tables grow into the hundreds of millions of rows. Many shops enable EF Core's EnableSensitiveDataLogging only in development, behind an environment check, so connection strings and parameter values never leak into production log streams hosted in Australian regions. The ACSC Essential Eight maturity targets push teams towards explicit database roles, separate connection strings for migrations, and a DbContext factory that background workers use to escape the scoped lifetime without leaking it into the host.
The combination of generic repositories, scoped DbContext registration, and a thoughtful async surface keeps the architecture clean. It also lines up with the conventions taught at community events across the country, from the .NET user groups in Sydney and Melbourne to the sessions at the C# Corner Annual Conference 2020, where the focus stays firmly on shipping production code rather than debating abstract patterns.
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