My Blog

Here you can find my private notes about programming that I wanted to share with you. Feel free to filter based on the topic you want or search for something specific.

    The INSERT statement conflicted with the FOREIGN KEY constraint "XXX". The conflict occurred in database "XXX", table "XXX", column "XXX" error and how to fix it

    It is very common to do migrations of data from a table of one database to another or inserting backed-up data into a table. For these tasks you will have to use long .sql scripts with INSERT statements.

    When doing such migrations one possible problem might be that the Foreign Keys referenced in the primary-table will throw the INSERT statement conflicted with the FOREIGN KEY constraint “XXX. The conflict occurred in database “”, table “”, column “” error.

    Read the complete article

    The complete guide to cast different types to and from enums in .NET Core

    Enumerations are a great way to standardize your code and move away from using string literals or integers for if-conditions. For example using this Gender gender = Gender.Female instead of this string gender = "Female" is much cleaner and you get a single point of change in the Enum. However, since you might dealing with legacy code, you will have to cast the strings or integers to your Enumerations when connecting new with old code. Lets see how this is done.

    Read the complete article

    How to validate your .NET Core WebAPI model and return a 400 (BadRequest) response from your controller and test it with Moq

    I know this is not a new question; however, if you search online, you will mostly find articles discussing the older .NET Framework. Here is my way of dealing with 400 (BadRequest) and 404 (NotFound) errors using the latest .NET Core 3.0 WebAPI methods.

    Read the complete article

    Get extra log information about errors happening on your Azure App Service

    When you run your application on an Azure App Service there will the case where you want some extra logging information when errors happen. A fast way to get the exact error and its stacktrace in your application is to activate the Application Logging. To activate it, you have to do the following simple steps:

    Read the complete article

    Implement a static Vue app and deploy it on Azure using CI/CD. Part 2, Continuous Delivery

    In the previous article we focused on building the Continuous Integration Pipeline of our hello-world Vue app.

    In Part 2 we are going to do the steps for deploying the result of the CI Pipeline to Azure. From there our static website is going to be visible to the rest of the world.

    Here are the steps you will have to take:

    Read the complete article