Teemablogi sissekanded

24.07.2018

String repeat method for C#

C# doesn’t have built-in function to repeat a string. There are different version for string. Repeat() available in internet and it’s up to reader to find out which version works better. Here is the list of most popular implementations I found across the web. I list my findings here with the results of simple performance test. String repeat implementations I found these six implementations to be. . . Source. 08:18 24.07.2018 kanalilt DT blogi 2

12.07.2018

ASP. NET MVC error: It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level.

Error when running ASP. NET MVC application from Visual Studio: It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. Stop inventing painful hacks, solution is here. How to reproduce This is what I have to do to get this error in Visual. . . Source. 07:30 12.07.2018 kanalilt DT blogi 2

11.07.2018

Adding search to Blazor applications

As my Blazor demo application supports now Azure AD I took the next step and implemented search using Azure Search service. This blog post shows how to add search capabilities to Blazor application using Azure AD protected Azure Functions back-end and Azure Search service. Source code available! Source code for my Blazor demo solution is available at my GitHub repository peipman/BlazorDemo. Feel. . . Source. 10:14 11.07.2018 kanalilt DT blogi 2

09.07.2018

Azure AD authentication in Blazor using ADAL.js

Although Blazor is in early stages of development it is already good enough to try out and play with it. As a logical continuation to my previous experiment where I made Blazor application use Azure Functions based back-end I made it also support Azure AD authentication on web application and back-end level. This blog post introduces my work on Blazor and Azure AD. Source code available! Source. . . Source. 07:23 09.07.2018 kanalilt DT blogi 2

05.07.2018

Running WordPress on .NET Core

About year ago I wrote a blog post Running PHP applications on . NET Core where I introduced how to build PHP applications to . NET Core using Peachpie. Their showcase was WordPress – the famous blog engine that also runs my blog. Peachpie guys have made significant work over year and they have reached the point where whole WordPress is built as . NET Core application. Why WordPress on . NET Core? As. . . Source. 08:53 05.07.2018 kanalilt DT blogi 2

04.07.2018

Hosting Azure Functions backed Blazor application on Azure Storage static website

My previous blog post was an introduction to static website hosting on Azure Storage. This post focuses on how to deploy Blazor application as a Azure static website on Azure Storage and how to use Azure Functions as a server back-end for Blazor application hosted as a static site. Source code available! Source code for this blog post is available in my GitHub repository gpeipman/BlazorDemo. Feel. . . Source. 08:58 04.07.2018 kanalilt DT blogi 2

03.07.2018

Introducing static website hosting for Azure Storage

Azure has new and interesting service for hosting static sites on blob storage. There is no additional server-side application hosting account needed to run public static sites – they run straight from blob storage. Although the service is in public preview, it is time to find out how it works and when we should consider using it. Why static sites? One can argue that static sites are history and. . . Source. 08:08 03.07.2018 kanalilt DT blogi 2

27.06.2018

ASP.NET Core Identity scaffolding

ASP. NET Core 2. 1 introduces Razor UI class libraries that allow us to share UI artifacts with libraries and NuGet packages. One of first official packages delivered with UI pieces is ASP. NET Core Identity. This blog post shows how to override default views of ASP. NET Core Identity by using scaffolding. Let’s start with ASP. NET Core 2. 1 application that uses individual accounts for users. ASP. NET. . . Source. 08:25 27.06.2018 kanalilt DT blogi 2

25.06.2018

Injecting services to ASP. NET Core controller actions.

ASP. NET Core comes with thin but rich and powerful built-in dependency injection mechanism we can use to inject instances to controllers and some other parts of web applications. Although constructor injection is the most famous dependency injection method for controllers there is also dependency injection to controller actions available. This post introduces controller action injection and shows. . . Source. 07:30 25.06.2018 kanalilt DT blogi 2

22.06.2018

Solving Remote Desktop problems on Windows 10

Remote Desktop is great thing when it works but with Windows 10 I usually see one problem after another. I decided to write up some tricks I need pretty often when RDP is going crazy on some Windows 10 box. Nothing special but I hope I save some people hours of time on trying out different tricks found in internet. Full screen RDP shows local taskbar in foreground This is one of the most annoying. . . Source. 10:09 22.06.2018 kanalilt DT blogi 2

20.06.2018

Running ASP. NET Core application as Windows service.

ASP. NET Core 2. 1 introduces new application host for Windows services. We can now run ASP. NET Core applications as Windows services with minimal effort. This blog post introduces how it is done and how to build and run Windows services on ASP. NET Core without any need for dirty hacks. Creating default web application We start with new default ASP. NET Core 2. 1 web application. I don’t configure. . . Source. 08:20 20.06.2018 kanalilt DT blogi 2

19.06.2018

Database level grouping in Entity Framework Core 2.

Previous versions of Entity Framework Core doesn’t support database level grouping and LINQ GroupBy is translated locally. Entity Framework Core 2. 1 translates LINQ GroupBy to database query in most of cases. Here is the example. To illustrate GroupBy translation I’m using database and some code from my multitenant ASP. NET Core sample solution. There is simple database with two entities not. . . Source. 08:52 19.06.2018 kanalilt DT blogi 2

18.06.2018

Adding attribute to backing field of automated property

There are scenarios where developers want to add attributes to backing field of automated property. It was hard to do before C# 7. 3. Now it is supported in Visual Studio and solution is simple. This blog post shows how to add attribute to backing field of automated property. Suppose we have a class with automated property and we want to apply some attribute to backing field of this property. Also. . . Source. 07:11 18.06.2018 kanalilt DT blogi 2

07.06.2018

Speaking at ITCamp 2018

Today and tomorrow I have honor to be a speaker at ITCamp 2018 at Cluj-Napoca, Romania. It is pretty big conference at Romania and I’m happy to see serious line-up of speakers and well organized event. Here is short overview of muy presentations at ITCamp 2018. I have two presentations: 07. 06 16:45 – Deep dive to C# 7This presentation is about new features in different versions of C# 7. I will. . . Source. 16:30 07.06.2018 kanalilt DT blogi 2

GDPR features in ASP.NET Core

As General Data Protection Regulation (GDPR) is now official in European Union (EU) there’s also some basic support for it included in ASP. NET Core 2. 1. Althouhg it’s not possible to come out with technical etalon for GDPR there’s still some good starting points available in ASP. NET Core. Here is the brief overview. Consent for non-essential cookies First GDPR thing we notice with ASP. NET Core. . . Source. 09:28 07.06.2018 kanalilt DT blogi 2

06.06.2018

Include for derived types in Entity Framework 2.1

When I wrote user interface for my TemperatureStation solution I faced some bad problems with Entity Framework Core when trying to query base type and get some navigation properties of derived types included. I was able to come out with some work-arounds that were far from being satisfying for me. Include for derived types in Entity Framework Core solves the problem. Problem Suppose we have some. . . Source. 06:33 06.06.2018 kanalilt DT blogi 2

05.06.2018

Razor Class Library with ASP.NET Core MVC

ASP. NET Core 2. 1 introduces Razor Class Library (RCL). It’s the new way how to share reusable web application components with UI as dependent project or NuGet package. As public examples mostly cover how it works with Razor Pages, I decided to write this blog post and demo application for ASP. NET Core MVC. Source code available! I created demo application that shows all stuff written here. Feel. . . Source. 07:17 05.06.2018 kanalilt DT blogi 2

04.06.2018

Pattern matching in switch statements

One of new features introduced by C# 7. 0 is support for pattern matching in switch statements. It’s like mix of switch and if statements so we don’t have to nest these two. This blog post introduces pattern matching in switch statements and shows what C# compiler produces of switch statements. Let’s take a look at the following switch statement that introduces new concepts. public static void. . . Source. 05:13 04.06.2018 kanalilt DT blogi 2

29.05.2018

Speaking at Riga Dev Days 2018

This week I am speaker at Riga Dev Days 2018 conference – the biggest one happening this year at Baltic states. It has workshops day on 29th of May and two conference days on 30th and 31st of May. My presentation is on 30th at 17:30 o’clock and it is about Azure Computer Vision services. Here’s more about the event and my presentation there. Riga Dev Days brings together the world class experts in. . . Source. 10:13 29.05.2018 kanalilt DT blogi 2

Analyzing images using Azure Cognitive Services

Computer Vision API of Azure Cognitive Services can be used to analyze and describe images. It’s rich API that supports also faces and landmarks recognition, not to mention automatic describing and tagging of images. This blog post shows how to use image analyzing features of Azure Cognitive Services. Source code available! This blog post is based on ASP. NET MVC demo application available at. . . Source. 07:28 29.05.2018 kanalilt DT blogi 2