Teemablogi sissekanded

14.11.2019

No need for repositories and unit of work with Entity Framework Core

After working again on codebase where Entity Framework Core was used through repository and unit of work patterns I decided to write eye-opener post for next (and maybe even current and previous) generations about what Entity Framework has to offer in the light of these to patterns. In many cases we don’t have to move away from database context approach but stick with it even more than we first planned. 07:32 14.11.2019 kanalilt DT blogi 2

10.11.2019

Building gRPC service on ASP.NET Core

ASP. NET Core supports gRPC protocol that is about to replace legacy SOAP services with more performant and powerful protocol that is easier to use and support. This blog post shows how to build gRPC service and client on Visual Studio and ASP. NET Core. What is gRPC? gRPC is modern high performance communication framework for connected systems. By nature it is Remote Procedure Call (RPC) framework. 19:11 10.11.2019 kanalilt DT blogi 2

07.11.2019

Using composite command in ASP.NET Core

My introduction to composite command pattern was more theoretical and focused to high-level details. This blog post focuses on implementation details and introduces how to use composite command in ASP. NET Core to upload and process photos. Composite command pattern Composite command is mixed design pattern that is made up of command pattern and composite pattern. 09:45 07.11.2019 kanalilt DT blogi 2

06.11.2019

Data annotations object graph validation is coming to Blazor

Future versions of Blazor will support cascading data annotations support meaning that validation of child components is also supported. First experimental bits were released counted hours ago with . NET Core 3. 1 Preview 2. Here’s how object graph validation will work in Blazor. Building object graph My previous post about Blazor form validation introduced how validation is implemented for EditForm element used on Blazor pages. 10:27 06.11.2019 kanalilt DT blogi 2

03.11.2019

Building Blazor “Hello, Blinky” IoT application

I thought first my ASP. NET Core edition of Hello, Blinky will be my last Hello, Blinky for long time. But then something reminded me of Blazor and I thought  why not build Blazor edition of Hello, Blinky for Windows IoT Core and Raspberry Pi? After some hacking I made it work. Here’s my Hello, Blinky for Blazor. Who the hell is Hello, Blinky? Hello, Blinky is kind of Hello, World from Raspberry Pi and other microboards world. 09:14 03.11.2019 kanalilt DT blogi 2

31.10.2019

File uploads in ASP.NET Core

Just wrote down something I had to went through with students in one of my classes – making file uploads work in ASP. NET Core application. Here are samples of single and multiple file uploads using simple controller actions. Creating upload action and view I start with clean ASP. NET Core application and add Upload() action to HomeController. public IActionResult Upload(){ return View();} It’s empty and returns just view to upload files. 17:56 31.10.2019 kanalilt DT blogi 2

26.10.2019

Composite command pattern

I have previously blogged about command pattern and composite pattern. I had some projects where I succesfully mixed these two together to compose a composite command. It’s a construct to have a commands hierarchy we can execute with one shot. Why composite command? Composite command is mix of command and composite patterns and it forms command that consists of child commands that are executed once together. 09:08 26.10.2019 kanalilt DT blogi 2

16.10.2019

Blazor pages get partial class support

Next . NET Core version 3. 1 brings some good news to Blazor – partial page classes. Maybe it’s not so big thing for many guys out there but sure great feature for those who like clean solutions. Here’s my story about partial page classes and their comparison with code-behind classes supported already today. Deafult weather forecast page When we create new Blazor application there’s page for weather forecast (named as FetchData. razor). 08:17 16.10.2019 kanalilt DT blogi 2

11.10.2019

Publishing ASP. NET Core 3. 0 application as self-contained executable to Azure App Service.

With Visual Studio 2019 we can publish ASP. NET Core 3. 0 applications as self-contained executable. It’s specially useful for environments where ASP. NET Core 3. 0 is not installed or where we don’t have permissions to install it. Here’s how to do it. Here's how to run ASP. NET Core 3. 0 applications on Azure App Services where . NET Core 3. 0 is not available. 06:28 11.10.2019 kanalilt DT blogi 2

06.10.2019

Generalize file access for ASP. NET Core applications using IFileClient implementations.

Once upon a time I worked out simple file client generalization so my applications can keep files on local machine or somewhere on the cloud without changes in application code. This blog post shows how to generalize file access in web applications and provides implementations for local and cloud file clients. This is how you generalize file access in your ASP. 08:42 06.10.2019 kanalilt DT blogi 2

02.10.2019

Hosting web application on Azure

Coming to cloud with web application can be scary if it’s the first time you do it. Azure cloud is not anymore about dozen of services – it’s real monster offering more than we are able to know and learn. It’s not easy to predict what will be the final path on cloud but it is possible to tell how to get started. Here’s how to do it. 21:34 02.10.2019 kanalilt DT blogi 2

What’s next for client-side Blazor

NET Conf 2019 was full of great news and interesting pieces of information for those who love . NET world like me. It was specially interesting for me to watch presentation The Future of Blazor on the Client by Dan Roth who introduced on-going work with Blazor and plans for near future. Here’s my short overview with explanations about what’s going on. Here’s the roadmap for client-side Blazor shown by Dan Roth during his presentation. 06:47 02.10.2019 kanalilt DT blogi 2

25.09.2019

All about IDisposable

So, what is IDisposable and what is disposing of objects? This is something I teach to developers classes before they are going to their first school practice at some company. One of important concepts is disposing. Here’s my story about it. Unmanaged resources – why we dispose objects? Let’s start with concept of unmanaged resources. Almost all of our applications use some resources like file system, database, web services etc. 15:22 25.09.2019 kanalilt DT blogi 2

19.09.2019

How many .NET Core SDK-s you REALLY have?

Do you have lightweight laptop with not very big laptop where you run Visual Studio? Do you need sometimes more space? You can make some free space if you remove . NET Core versions installed over time by updates and previews. Here’s how to do it. Once I checked installed applications on Windows 10 laptop to see if I can make some more space. I found out that I have long list of . NET Core versions installed over time. 15:39 19.09.2019 kanalilt DT blogi 2

18.09.2019

Using Roslyn to build object to object mapper

Back in time I wrote series of posts about how I built simple object to object mapper. It was nine years ago and from them more things have changed. Today I added one new implementation of mapper and this one is using Roslyn compiler services to generate dynamic code for mappings. Dynamic code in current era As I’m new to compiler services I found some great starting materials: Simple sample of using Roslyn on. 07:42 18.09.2019 kanalilt DT blogi 2

05.09.2019

NHibernate on ASP.NET Core

NHibernate has been my favorite ORM for long time. Although it’s more complex for beginners than Entity Framework it’s more matured and many developers consider it to be practially an industry standard. NHibernate works with ASP. NET Core too. This blog post shows how to use NHibernate in ASP. NET Core MVC applications. I was pleasantly suprised seeing that NHibernate is now on. 07:00 05.09.2019 kanalilt DT blogi 2

04.09.2019

Create thumbnails using Azure Cognitive Services

Azure Cognitive Services is set of powerful and intelligent cloud services to analyze photos and images. This blog post shows how to create smart thumbnails using Azure cognitive services and ASP. NET Core. Why thumbnail service? Back in time I had to argue with one customer about how thumbnail should be done. There was popular misconception that GetThumbnailImage() method in. 11:41 04.09.2019 kanalilt DT blogi 2

20.08.2019

Visualize Azure CDN metrics with Grafana

Azure CDN is one of Azure services that doesn’t provide charts and metrics in service overview page. For me these charts are important because they help me to optimize delivery of my blog artifacts. This blog post describes how I visualize Azure CDN diagnostics logs using InfluxDB, Grafana and simple data collector. 11:14 20.08.2019 kanalilt DT blogi 2

16.08.2019

System memory health check for ASP.NET Core

I found temporary cross-platform solution for . NET Core to read system memory metrics until framework level libraries appear. This blog post shows how to build ASP. NET Core health check for system memory metrics. Getting started We are using MemoryMetricsClient class defined in blog post referred above. The class with MemoryMetrics result is given here again. 07:06 16.08.2019 kanalilt DT blogi 2

15.08.2019

Reading Windows and Linux memory metrics with . NET Core.

Until . NET Core gets its own cross-platform system metrics support I needed something simple to get system memory metrics of servers where ASP. NET Core application is running. I wasn’t able to find a nice solution but I still worked out something to get system memory metrics with . NET Core on Windows and Linux. My scenario I solved both cases by using simple command line. 21:27 15.08.2019 kanalilt DT blogi 2