Teemablogi sissekanded


VS Code for PHP development

Although most of my work time is spent on ASP. NET and SharePoint development I also have some PHP projects. I have my own favorite thin tooling for PHP but I decided to give a try to Visual Studio Code (VS Code) with one of the projects. This blog post describes what I have in my dev box and what are my first impressions using VS Code for PHP development. Why VS Code? VS Code is not IDE like Visual Studio. 10:00 16.02.2018 kanalilt DT blogi 2


Culture based views in ASP.NET Core

ASP. NET Core supports culture based views for more complex localizations. It means we have one view per culture per controller action. This blog post shows how to use culture based views in ASP. NET Core and how to implement them. Sample solution. Working code introduced here and in my blog post ASP. NET Core: Simple localization and language based URL-s is available in GitHub repository gpeipman/AspNetCoreLocalization. 10:00 15.02.2018 kanalilt DT blogi 2


Reading request body in ASP.NET Core

Most of requests to controller actions of our ASP. NET Core applications send some simple parameters or some serialized model objects. But this is not always the case. There are also those requests we don’t want to map to models but we need the request body to process, save or use it some other ways. This blog post shows how to read request body in ASP. NET Core controller action. 09:47 12.02.2018 kanalilt DT blogi 2


Building pager tag helper

Tag helpers are classes that can be applied to HTML and special tags in ASP. NET Core views. They are addition to HTML helper extension methods and they provide more flexibility by having their own classes and supporting framework level dependency injection. This blog post demonstrates how to create pager tag helper to support displaying paged results in ASP. NET Core views. 10:05 06.02.2018 kanalilt DT blogi 2


New killer features planned for . NET Core, ASP.

Microsoft announced roadmap for upcoming release of . NET Core family versioned as . NET Core 2. 1. While there are some new features and many improvements coming I compiled a list of my favorites that I see as most imortant to all developers building solutions on . NET Core, ASP. NET Core and Entity Framework Core. . NET Core 2. 09:45 05.02.2018 kanalilt DT blogi 2


Entity Framework Core with . NET Core console application.

ASP. NET Core makes it very easy to configure and use Entity Framework Core in web applications. For . NET Core console applications there is no such machinery available but we can still use Entity Framework Core in console applications. This post shows how to wrap database context initialization to separate class and use Entity Framework Core synchronous and asynchronous calls in . NET Core console application. 10:07 01.02.2018 kanalilt DT blogi 2


Switching C# version in Visual Studio

Want to try out features of newest of some specific version of C# but Visual Studio 2017 can’t compile it? Well, by default major versions of C# are supported and if some other version is needed it must be turned on from project settings. This blog post shows how to switch between C# versions in Visual Studio 2017. To make Visual Studio 2017 to use some other version of C# follow the steps shown on the following image. 10:03 30.01.2018 kanalilt DT blogi 2


ASP.NET paging solution available at GitHub

Paging of data in ASP. NET and ASP. NET Core applications is timeless topic. It is invented over and over again and asked all the time in forums all over the world. Years ago I worked out kind of universal solution with reusable UI artifacts and I’m using these pieces this far. As ASP. NET Core is gaining more and more popularity I decided to start my sample solution with . NET Core and add full ,NET Framework and ASP. 10:00 29.01.2018 kanalilt DT blogi 2


Ref returns and ref locals in C# 7.0

C# 7. 0 introduces ref returns and ref locals. Main goal of these new features is to make it easier for developers to pass around references to value types instead of copies of their values. This is important when working with large data structures that are implemented as value types. This blog post shows how to use ref returns and ref locals in Ć#. 09:56 26.01.2018 kanalilt DT blogi 2


NHibernate supports async

NHibernate, the O/R-mapper that some people consider as dead, is actually alive and very much alive. The release of version 5. 0 at last autumn was somehow quiet and didn’t got much attention. But there is something that brings NHibernate to modern era – support for asynchronous database access. This blog post gives brief overview of new async methods in NHibernate and shares some ideas about how to start using them. 09:14 25.01.2018 kanalilt DT blogi 2


Refactoring: Replace Exception with Test

Exceptions are mechanism to transport information about errors in object-oriented code. But they come with performance hit when not used carefully. Still we find a lot of code when exceptions are not avoided but used as a control mechanism in code flow. This post introduces replace exception with test refactoring that helps us to avoid at least some exceptions. 09:58 24.01.2018 kanalilt DT blogi 2


New expression bodied members in C# 7.0

Although expression bodied members have been supported in C# few years there were still room for some new ones. C# 7. 0 introduces expression bodied constructors, destructors, getters and setters. This blog post goes through all these new expression bodied members and shows how to use them. Also a little peek behind the compilator curtains is made. 10:16 23.01.2018 kanalilt DT blogi 2


Internals of tuple literals

My last post about tuple literals gave brief introduction to these. This post goes to internals of tuple literals, peeks behind the compiler and shows what happens with tuple literals internally. This post is for developers who are new to tuple literals and want to gain more deep understanding of these. Tuple literals after compiling Let’s write a simple piece of code, compile it and then decompile it without PDB-file available. 09:54 22.01.2018 kanalilt DT blogi 2


Refactoring: Improving the Design of Existing Code

Although I bought refactoring book by Martin Fowler years ago it is still valid. I call it one of the timeless books about coding and I consider it as a mandatory reading specially for novice programmers who are entering the field. Of course it is also useful handbook for those already in business. 21:02 12.01.2018 kanalilt DT blogi 2


Performance of compiled queries in Entity Framework Core 2.

Before applying any optimizations to our code we have to ask one question: what is the cost of improvement and is it really improvement? Compiled queries in Entity Framework 2. 0 are categorized as high-availability feature but before making any decisions we need to know what is the actual win. This blog post introduces the measurements I made with simple database context to compare compiled and uncompiled queries in Entity Framework Core 2. 10:02 10.01.2018 kanalilt DT blogi 2


Compiled queries in Entity Framework Core

Entity Framework Core 2. 0 introduces explicitly compiled queries. These are LINQ queries that are compiled in advance to be ready for execution as soon as application asks for data. This blog post demonstrates how compiled queries work and how to use them. How queries are executed? Suppose we have database context class with method to return category by id. 10:39 09.01.2018 kanalilt DT blogi 2


Writing IL code on Visual Studio

Microsoft Intermedia Language (MSIL) is . NET assembly language that is standardized under name Common Intermediate Language (CIL). All . NET compilers turn source code to this language. Although we hardly have a situation where we have to write intermedia language (IL) code directly it is still good to know how it works and how it is supported on Visual Studio. This blog post fills the gap and shows how to write IL code on Visual Studio. 10:02 08.01.2018 kanalilt DT blogi 2


Real-time talk between Windows 10 IoT Core background task and ASP.

My previous blog post introduced how to make ASP. NET Core 2 web application run on Windows 10 IoT Core. It was default web application created on Visual Studio and published as an executable. But this is not enough for IoT scenarios. When we build web application that runs on IoT board we need this application to do something. Be it displaying sensor data or controlling some hardware. 10:28 02.01.2018 kanalilt DT blogi 2


How to avoid overlapping timer calls?

Timers are useful . NET feature. With timers we can execute code with specified interval. With real scenarios we can easily face situations where timer calls its callback again but previous call is not finished yet. It may end up with loading some external system too much. It may also end up by making unexpected parallel data processing that distorts the results. This post introduces some options to avoid overlapping timer calls. 10:12 18.12.2017 kanalilt DT blogi 2


Are lock and Monitor the same in C#?

Working on some threading stuff I stumbled upon some discussions about lock and Monitor. Some say they are different and some say they are the same. I took few minutes of time to make some simple experiments with both of these. This blog post shows what C# compiler does with lock statement. As I had to use also Monitor class I added one example here how to use it instead of lock. 10:37 15.12.2017 kanalilt DT blogi 2