CategoryProgramming

Dockerized Web API in .NET Core

This weekend I decided to try setting up a simple Web API with .NET Core and Docker running it on Linux. The process was really straightforward. I got it up and running almost immediately. So I decided to share the process.

Continue reading

Angular 1.5 todo app

I have been using Angular for over 3 years. A few months ago Angular 1.5 came out and they introduced the .component() method, which is basically the same as an element directive but with a much simpler API. Since then I’ve fallen more and more in love with Angular so I decided to write a small todo app utilizing the component architecture along with some cool things in the Angular world.

First of all I’m not much of a designer so I want to thank TodoMVC for the UI.

Anyway, the app consists of:

I’m not gonna talk much about these in depth, only high-level about what they are and why I chose them. This article will mainly be about how I decided to structure and implement the app.

Continue reading

My Atom setup

I recently started using Atom, this awesome web-based editor from GitHub. My previous editor was Sublime Text but I decided to make the move. Why? Because Sublime has a slow development.

Version 2 of Sublime Text was initially released in 2011 and last release was in July 2013. Still it’s the main version! Version 3 last release was in March 2015 — and it’s still in beta and hasn’t gotten an update for 10 months. Don’t get me wrong, Sublime is awesome, but it’s not under active development. Atom is very active and has been from the start, Sublime is not. Atom is also open-source, Sublime is not.

However, this is about my Atom setup, not a rant about why Atom is better than Sublime.

Continue reading

Isolating your BLL from your DAL and unit testing it

This article will teach you how to set up a basic service and repository, to isolate your BLL (Business Logic Layer) from your DAL (Data Access Layer), so you can easily create unit tests for your BLL. This solution doesn’t use any ORM (Object Relational Mapping) like e.g. Entity Framework. This is only to explain how to isolate logic from data and how to test your logic in isolation.

Continue reading

How to mock and test WCF services using Moq

I really needed to mock and test WCF services for a new project I’m working on. I had heard great things about the Moq mocking framework so I decided to use that.

Continue reading

.NET Config Transforms and how they are useful

Config Transforms are a nifty method to have your configuration vary, depending on which build configuration you are running or what servers you are publishing to. This gets the most useful when you’re deploying to many kinds of different servers; Development, staging, production, etc.

Continue reading

How to create and publish a NuGet package

NuGet is the package manager for the Microsoft development platform including .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery is the central package repository used by all package authors and consumers.

This post will create you how to create and publish your own NuGet package.

Continue reading

Problem with SimpleMembership and Roles

I had a problem with SimpleMembership, Authorize attributes and roles. When I ran my program, I occasionally got the following error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)

To fix it, I had to go to /Account/LogOff and log in again. Very weird problem. I tried Googling it without any luck, until I stumpled upon this blog post. That saved my day. I decided to write down the method here, in case if his blog went down. For users who stumble upon this problem. Continue reading

WebMatrix SimpleMembership upgrade path

Before Microsoft released MVC 4, I created my project with the good old ASP.NET Membership Provider. After release of MVC 4, Microsoft switched to SimpleMembership by WebMatrix. My project was pretty huge, so I searched for an upgrade path to switch without harming the project. I was in no luck finding a method to switch over, so I followed my own “upgrade path” and decided to share it with the world.

Continue reading

How to mock the DataContext (Entity Framework)

Earlier I wrote an article about how to mock the LINQ DataContext. I promised to write an article about how to do the same method with Entity Framework. It’s quite similar, but the only difference is creating an IDbContext interface and using DbSet<T>. Continue reading

© 2017 Gaui.is

Theme by Anders NorenUp ↑