Auto-populating a field in an EF Core entity

I am work­ing on the back end for a web-based SAAS appli­ca­tion, writ­ten in C#, and using .NET Core 2.1.  The data­base is most­ly han­dled by Entity Framework with cus­tom code that sup­ports the archi­tec­ture as a whole.

I had the sim­ple require­ment of pop­u­lat­ing a col­umn in our data­base with the “own­er” (or cre­ator) of the record.  The own­er is an appli­ca­tion user, and it is com­plete­ly depen­dent on the con­text of the cur­rent request. I want­ed to make this require­ment trans­par­ent to the rest of the application.

Continue read­ing…