Hacking C#: Programming for the truly lazy

#288 – December 08, 2019

sponsor

C# Developers are in demand on Vettery

Vettery is an online hiring marketplace that's changing the way people hire and get hired. Ready for a bold career move? Make a free profile, name your salary, and connect with hiring managers from top employers today.

this week's favorite

Hacking C#: Programming for the truly lazy

This is the first in a series of articles I'm planning to write on some of the techniques I've used over the years to accomplish a whole load more in C# with as little effort as I can get away with. I'm very much of the opinion that life is too short to spend writing the same old boilerplate code, and that every problem only ever needs to be solved once. Hopefully this article series will open your eyes a little to what can be done with a bit of imagination.

.NET Core 3.0.1 and Entity Framework Tools Issue

If you're using .NET Core 3 and Entity Framework Core 3 together, you're probably using the EF Tools too. I've been running into an odd issue with it and wanted to share what is going on.

BookFx: an extremely effective method for creating Excel workbooks

Forget VBA. Excel API for VBA probably was convenient for a recording of macros, but it is inconvenient for a xlsx generation. This is due to the classic Excel API use the imperative approach and the mutable model, therefore we cannot consume the API without of endless statements and side effects. EPPlus, ClosedXML, NPOI and others are great libraries, but they all repeat the macros API. Instead we can use the immutable model, the declarative approach, the fluent interface and the method chaining. This will allow us to write pure functions and expressions instead of statements.

Dependency Injection, Architecture, and Testing

Depenency Injection, or DI, is a Software Architecture Design Pattern. DI is something that comes up during discussions on SOLID, IoC (Inversion of Control), testing, and refactoring. I want to speak on each of these briefly because DI touches all of these. But before I really dive into things, I want to define what a dependency is. A dependency is any object that another object requires. So all of those classes, services, and libraries that we use to build our applications are dependencies.

The Difference Between IEnumerable and IQueryable Explained

I’ve always been curious how ORMs work. How does C# code get converted into SQL statements? Research on that topic led me to blog about Expressions and the Visitor Pattern. I’ve also read a lot about the difference between the IEnumerable and IQueryable interfaces. But it took me awhile to really understand what made them different.

newsletters