Teemablogi sissekanded

30.01.2020

Building experimental hybrid Blazor WebAssembly application

After getting done with Blazor desktop applications I tried to build kind of hybrid Blazor WebAssembly application that can run on desktop and in web equally. Although I failed to make it as one single application, I still got it work with a little different architecture. And what’s best – Blazor desktop applications run already now as self-contained executables. Here’s my experiment. 08:42 30.01.2020 kanalilt DT blogi 2

29.01.2020

Exploring WebWindow examples for Blazor on desktop

Blazor on desktop is one of latest hot topics and . NET Conf: Focus on Blazor only added more fuel to fire. Blazor seems to come everywhere and it’s unstoppable. One of interesting desktop experiments is WebWindow by Steve Sanderson. It’s cross-platform component to make Blazor WebAssembly applications run on desktop. Let’s take a closer look at WebWindow and Blazor on desktop. 08:16 29.01.2020 kanalilt DT blogi 2

27.01.2020

Start with Surface Duo development on preview emulator and SDK today

Surface Neo and Surface Duo are new devices by Microsoft, planned to launch for holidays season this year. Surface Neo runs Windows and Surface Duo is based on Android. For Surface Duo there’s already preview tooling and SDK available by Microsoft. Here’s the introduction to Surface Duo development, tools and patterns. With Surface Neo and Surface Duo Microsoft enters a era of hybrid devices. 07:10 27.01.2020 kanalilt DT blogi 2

23.01.2020

Creating subdomains to Azure DNS from ASP.NET Core

Multitenant wep applications detect current tenant usually by URL checking name of first level folder or subdomain. Usually tenants are defined by subdomain as it is easier to distribute them over data center, cloud services or hosting accounts. This blog post demonstrates how to build Azure DNS service client to create DNS records for multitenant application subdomains. 08:01 23.01.2020 kanalilt DT blogi 2

22.01.2020

Inject users and roles dynamically to ASP. NET Core integration tests.

After getting fake authenticated user to ASP. NET Core integration tests I made step further and introduced the way to use different user accounts. Using multiple users and roles instead of one test users is very common scenario in web applications. During my carreer I have seen only few business applications that doesn’t use different roles. This blog post demonstrates how to inject users dynamically to ASP. NET Core integration tests. 07:00 22.01.2020 kanalilt DT blogi 2

20.01.2020

Behind the compiler: 20 examples of C# code before and after compiling

Over years I have written many blog posts about C# and . NET that demonstrate also how things work internally and what C# compiler produces from the code we write. I have called these chapters usually as “Behind the compiler”. This post is growing list of my writings covering interesting findings about C# compiler work. Behind the compiler posts Throw expressions in C# 7. 0 Using-declarations in C# 8. 07:00 20.01.2020 kanalilt DT blogi 2

15.01.2020

Announcements from .NET Conf: Focus on Blazor

Microsoft made very interesting announcements at . NET Conf: Focus on Blazor online conference. There are many great things are happening and Blazor is also making a fast progress on finding its way to mobile and desktop. Here’s the short overview of what’s happening and what’s coming next. Blazor WebAssembly new features for May Features of Blazor WebAssembly (aka client-side Blazor until now) were announced by Dan Roth: Runs on. 05:41 15.01.2020 kanalilt DT blogi 2

14.01.2020

Create fake user for ASP. NET Core integration tests.

After getting done with fake users for ASP. NET Core controller unit tests I wanted to make fake users available also in integration tests. It took some inventing and hacking but I made it work. This blog post shows you how to create fake users for ASP. NET Core integration tests and write effective extension methods to keep integration tests shorter. Source code available! Thin and clean demo solution with ASP. 06:41 14.01.2020 kanalilt DT blogi 2

11.01.2020

Create fake user for ASP.NET Core controller tests

I think most of ASP. NET Core applications have authentication enabled. When writing unit tests for controllers we have one set of tests that need authenticated user and other set of tests that need anonymous user. Faking User property of controller is a little bit tricky. This blog post shows how to do it. Source code available! Source code and sample ASP. 14:50 11.01.2020 kanalilt DT blogi 2

10.01.2020

Embedded Power BI reports with ASP.NET Core

Last year I had some projects where I had to embed Power BI reports to ASP. NET Core applications. There were easy cases that solved practically with copy-paste but I also had more complex situation where server-side code was needed because application uses custom authentication instead of Azure AD. This blog post covers both scenarios for embedding Power BI reports to ASP. NET Core applications. 07:17 10.01.2020 kanalilt DT blogi 2

08.01.2020

DataSet and DataTable based ad-hoc reporting with ASP.

In one of my projects I have some ASP. NET Core views that display multiple tables with reporting data. Data comes from SQL Server views and stored procedures and these can be modified in database without deploying application to server again. I came out with very common solution in ASP. NET Core to solve this problem using raw SQL commands and shared views for DataTable and DataSet. Here’s what I did. 06:21 08.01.2020 kanalilt DT blogi 2

07.01.2020

Execute raw SQL commands in Entity Framework Core

I have never seen a real-life project where object-relational mapper generates 100% of needed SQL. There have always been those special cases when raw SQL commands are needed. In this post I will demonstrate how to run raw SQL commands in Entity Framework Commands and how to read data from database without DbSet and query types. 10:06 07.01.2020 kanalilt DT blogi 2

03.01.2020

Get notification to e-mail when I post something

First of all – thanks to all my blog readers to be here with me. Last year was the one where the most important metric of blogs – number of page views – made its yearly record and reached a million. What should I say? Thanks a million! As some of you have asked my for one feature my blog should have I’m glad to tell you it’s here – yes, you can get e-mail notifications about new posts published here. 13:08 03.01.2020 kanalilt DT blogi 2

02.01.2020

Using CSOM from Azure Functions

I got back to active SharePoint and CSOM development some months ago and first thing to do was to port bunch of workflows from in-prem SharePoint to cloud. Where I live we don’t usually have any simple workflows. Most of them need some backing code due to custom logic. So, my only option was to go with Microsoft Flow or Azure Logic Apps and Azure Functions. Here’s the project with one dummy function to get started. 10:13 02.01.2020 kanalilt DT blogi 2

30.12.2019

Copy production database to staging on Azure DevOps

I’m building build and release pipeline on Azure DevOps for one of my projects. We want to automate testing and deployments to staging environment. At staging environment we want to use copy of production database to make sure that testers are working with latest data. Here’s how to make Azure SQL database copy on Azure DevOps using Azure PowerShell. My scenario What I’m building is shown on the following image. 09:18 30.12.2019 kanalilt DT blogi 2

19.12.2019

Using nameof operator in C#

There’s one very useful and often overlooked operator in C#. It’s called nameof and its purpose is to return name of something. Although it is operator we can live without it may still commit to coding by pointing out some errors at compile time. Here’s how to use the nameof operator in practice. How nameof operator works? Nameof operator can return names of different code artifacts. 08:50 19.12.2019 kanalilt DT blogi 2

17.12.2019

Logging NHibernate SQL commands to debug window

I know there are advanced tools like SQL Server Profiler and NHibernate Profiler but often I want to see NHibernate queries just in debug window to have overview of what’s going on. It’s specially important when improving some legacy application where previous developers had not much idea how NHibernate works. Here’s the simple solution I’m using to get SQL generated by NHibernate to Visual Studio debug window. 06:53 17.12.2019 kanalilt DT blogi 2

11.12.2019

Using configurable composite command in multi-tenant ASP.

My previous posts about tenant-based dependency injection and using composite command in ASP. NET Core culminated with idea to use configurable composite commands in multi-tenant ASP. NET Core applications. Configurable composite commands make it easy to tweak save and update processes that contain multiple steps of what some can be custom and their activation is based on tenant configuration. Here’s how to build thost composite commands. 10:26 11.12.2019 kanalilt DT blogi 2

09.12.2019

Using Windows Forms DataGridView in .NET Core 3.1

Windows Forms is coming to . NET Core and last version of Visual Studio 2019 Preview comes with form designer built in. There are basic controls available in toolbox but not all out-of-box controls have made their way there. One of these is DataGridView. Although not shown in toolbox, DataGridView still works like expected. Here’s how I made it work. NB! Form Designer for. 08:53 09.12.2019 kanalilt DT blogi 2

02.12.2019

Tenant-based dependency injection in multi-tenant ASP.

One need in multitenant applications is injecting dependencies based on tenant configuration. It can be actually more complex as instances may need constructor parameters. Here is my example of dynamic injection of multiple file clients in ASP. NET Core multi-tenant web application. Source code available! Source code for all my ASP. 00:09 02.12.2019 kanalilt DT blogi 2