Steve Collins

Information & Communications Technology

c# .NET ASP.NET Core Configuration Managent Dependency Injection Automated Code Generation

Worthing, England, United Kingdom

Steve Collins

Freelance software developer based in the South East of the UK

Steve Collins is an independent software developer/architect with over 25 years’ experience in the industry working with Microsoft technologies.

Blog - https://SteveTalksCode.co.uk
Twitter - @SteveTalksCode

Steve is a regular speaker at user groups around the UK and has presented at NDC London and DDD conferences

Current sessions

.NET Dependency Injection - The .NET 6 Booster Jab

Dependency Injection has been available out of the box in .NET since the introduction of .NET Core, but the way we work with it in ASP.NET Core is changing in .NET 6 thanks to the new WebApplicationBuilder class and Minimal APIs.

In this talk, we will look at the differences between .NET 5 and .NET 6 application bootstrapping and why doing everything in the Program.cs file is perhaps not such a good idea.

We also take a deep dive into understanding the different dependency lifetimes and how things can go wrong when incorrectly mixed together,

Lastly, we look at how we can
* avoid common service registration problems and mistakes
* understand how dependency lifetimes affect middleware
* avoid memory leaks when using 'disposable' objects
* apply workarounds to use injection styles not supported out of the box

The talk assumes that you have already had an initial dose of DI knowledge and are now ready for a top up to avoid some nasty bugs.

About the .NET Dependency Injection - The .NET 6 Booster Jab talk

Target audience - Intermediate .NET developers

Session Time : 60 minutes
Preferred Session : Morning session

Previous presentations of talk

This is a new updated version of a talk (based on .NET 5) that has previously been presented online to user groups in the UK, DDD Reading and NDC London 2021 (https://www.youtube.com/watch?v=JwVtscL9H9k) and finally as a webinar for JetBrains (https://youtu.be/Sjo0odZ4bwc)

The first outing of (an extended version of) this .NET 6 version has been presented online to DotNetDevs Austria - https://www.youtube.com/watch?v=gzMIhgGE4_o

The version of the talk being submitted here goes into less detail so that it will fit into a 55 minute time-slot.

Examples of other talks that I have presented in person can be seen on You Tube
* DDD East Midlands - The Source Code Generation Game - https://www.youtube.com/watch?v=3IuDAp9xV3w&t=2642s
* .NET Sheffield - https://www.youtube.com/watch?v=kLl2Mt3eYxU&t=613s

Previous Presenting Experience at User Groups / Community Conferences
* DDD Reading, DDD North, DDD East Anglia, DDD East Midlands
* .NET Notts, .NET Cambridge, .NET Sheffield, .NET Milton Keynes, .NET Oxford, South Coast Developers

Podcast appearances talking about Dependency Injection
* https://dotnetcore.show/episode-49-configuration-in-net-core-with-steve-collins/
* https://unhandledexceptionpodcast.com/posts/0024-stevecollins/

Other podcast appearances talking about .NET Configuration
* https://dotnetcore.show/episode-49-configuration-in-net-core-with-steve-collins/
* https://www.dnistream.live/show/12-file-configuration-blues

Video Streaming appearances
* https://youtu.be/0x2KW-dJDQU

Hosting User Group
* https://www.meetup.com/Milton-Keynes-NET-Meetup-Group


The [Source Code] Generation Game

There has been a lot of buzz around the introduction of source code generators in .NET 5 and it's there's more to come in .NET 6 and .NET 7 .

But, how did we get here and what may the future hold?

Starting with the question of "What is code generation?", I present a brief history of my journey into source code generation, starting with the ZX Spectrum (program published in a UK magazine to convert machine code into BASIC DATA statements), through the Visual Basic 3-6 years (VB code created when element clicked upon; tools to generate VB from SQL tables and stored procs)

I will then move on to do a whistle-stop tour of
* How .NET introduced tooling in Visual Studio for code-generation for SOAP Service Reference clients, RESX resources and the pitfalls of the code generated
* How previously, most code generation has been template based using external tooling run outside VS to generate files that need to be manually included in .NET projects to compile
* Introduction of T4 templates in Visual Studio (leading onto .NET Core's dotnet new command line templates)
* Code generation "on-the-fly" in Regular Expressions (intermediate code or compile to MSIL) and Entity Framework (SQL statement generation)
* Latest version of service reference code generation for REST and gRPC in .NET 5

The remainder of the talk will focus on the source generators introduced with .NET 5, covering
* How they differ from traditional template based code generation by being part of the compilation process
* Tooling to help debugging introduced with VS2019 16.10
* Gotchas with the tooling in Visual Studio!
* Unit testing code generation

Lastly, we will look at where source generators may go in the future
* More out of the box use, such as System.Text.Json in .NET 6
* Could there be potential for working with Intellicode and Github Copilot integration?
* "Computer make it so" - Experiments being done in AI generated code without a template or specification

Target audience - Intermediate .NET developers

Session Time : 60 minutes
Preferred Session : Morning session

Previous / scheduled presentations of talk
* DDD East Midlands 2021 (in person) - https://www.youtube.com/watch?v=3IuDAp9xV3w&t=2642s
* DDD Reading 2021 (online)
* South Coast Developers User Group (online)
* .NET Notts - scheduled May 2022 (online)

Examples of other talks that I have presented in person can be seen on You Tube
* .NET Sheffield - https://www.youtube.com/watch?v=kLl2Mt3eYxU&t=613s

Previous Presenting Experience at User Groups / Community Conferences (other talks)
* DDD Reading, DDD North, DDD East Anglia, DDD East Midlands
* .NET Notts, .NET Cambridge, .NET Sheffield, .NET Milton Keynes, .NET Oxford, South Coast Developers

Podcast appearances talking about Dependency Injection
* https://dotnetcore.show/episode-49-configuration-in-net-core-with-steve-collins/
* https://unhandledexceptionpodcast.com/posts/0024-stevecollins/

Other podcast appearances talking about .NET Configuration
* https://dotnetcore.show/episode-49-configuration-in-net-core-with-steve-collins/
* https://www.dnistream.live/show/12-file-configuration-blues

Video Streaming appearances
* https://youtu.be/0x2KW-dJDQU

Hosting User Group
* https://www.meetup.com/Milton-Keynes-NET-Meetup-Group