Tuples first appeared in C# with .NET Framework 4.0. They were supposed to be a lightweight alternative for small classes that were created if a method had to return more than one value.
Entity Framework is an Object-Relational Mapper for .NET applications, and the code-first approach using Entity Framework allows developers to use their domain model to build and query databases directly from their data model objects. In this article, we’ll take a look at how to use the Entity Framework in C# to create a table in a PostgreSQL database. Using a domain model for Car a as an example, we’ll take a look at different ways to configure the framework using data annotations and take a look at how different model decoration attributes affect the underlying table created by Entity Framework. You […]
Database caching is a commonly used technique to improve scalability. By offloading database work to other, faster stores it can also help improve the availability of the data too. Often, though, that caching comes at the cost of hardwired code in the application to check the cache first before the database. But what if we could do it cheaply and transparently to the application? Let’s try to leverage the C# and the features of Entity Framework 6 to do all the heavy lifting. I’ll show how to use PostgreSQL database with the framework and how to add transparent caching using […]
Recent release of ASP.NET Core 1.0 is very promising. It’s all open source and cross-platform. So let’s try to create something!
Reading redirected child output seems to be an easy task. But there are developers that struggle with child process hanging because of console write / read deadlocks. And deadlocks are never easy to investigate.
I often hear questions about running sub-process in parent’s console. People got confused about how to make sure that the child process uses the same console as the parent.
It’s time to sum up all C# 6 features. Here is a list of all goodness with short examples implemented and tested in Visual Studio 2015. nameof String interpolation Null-conditional (?. and ?) and null-coalescing (??) operators Index initializers Extension methods visible in collection initializers Exception filters Auto-property initializers Expression-bodied members Static using Extended async / await support I’ve also found few features that were planned to be included in C# 6 but finally where dropped. Parameterless constructors in structs – details in New Features in C# 6 article from November 2014 Primary constructions – details in The New and […]
There were new keywords introduced in C# 5 – async and await. But not everyone knows that they were forbidden in catch and finally blocks. It has been fixed with C# 6 release.