Many times I was asking myself what’s better IoC container for this or that project. Their performance is the one side of choice. You can find the complete performance comparison here. Another side of the choice is the simplicity and speed to learn. So I decided to compare several containers from this perspective and took Autofac, Simple Injector, Structure Map, […]
- May 21, 2016
#ASP.NET, #TDD, #testing, ...
In most cases you want to have integration tests for your WebAPI, but don’t deploy it on IIS. There is an option which allows to skip IIS pipeline and work only with ASP.NET one. You may create an HTTP server in memory and call the same endpoints as usual. This is easy and allows to cover […]
- May 20, 2016
You want to extract a domain from URL. The list of URLs to support might be as below. For this list you expect the domain
sub.domain.com : sub.domain.com/folder?p1=v1 www.sub.domain.com/folder?p1=v1 http://sub.domain.com/folder?p1=v1 https://sub.domain.com/folder?p1=v1 https://www.sub.domain.com/folder?p1=v1 For this list you expect the domain
domain.com: domain.com/folder?p1=v1 www.domain.com/folder?p1=v1 http://domain.com/folder?p1=v1 https://domain.com/folder?p1=v1 https://www.domain.com/folder?p1=v1 For this list you expect the domain
sub.sub.domain.com: sub.sub.domain.com/folder?p1=v1 www.sub.sub.domain.com/folder?p1=v1 http://sub.sub.domain.com/folder?p1=v1 https://sub.sub.domain.com/folder?p1=v1 […]
I met not so much company cultures, but quite enough to understand some common rules. Some of them would make your company culture nice and warm, and some would make it opposite. So if you want your company to be stated in IT community as an example of bad culture follow these rules. Rules of bad […]
I’m using AppVeyor CI for my small open-source projects and bumped into an issue with integration tests which need a different connection string in different environments. I’ll describe how this can be solved in two ways. The 1st is a similar to web.config XML transformation. The 2nd one is a workaround for AppVeyor using and approach which is […]
This is a quick guide to internal implementation of such C# types as Dictionary, Hashtable, List and others.
It is important if your item will be used as a key in a dictionary, or HashSet, etc – since this is used to group items into buckets (in the absence of a custom IEqualityComparer). If the hash-code for two items does not match, they may never be considered equal and Equals() will never be called. […]
When you’re testing a web service or web site with authentication credentials posted via HTTP headers, you might want a way to inject testing credentials without login in. Fiddler could help with that, but its rules need to be configured. Below I’ll describe how to do that Fiddler v4.5 (did not experiment in earlier versions).
If you notice that the context returns the same entity even if it is already changed one line before, you probably what the following
ObjectContext context = ((IObjectContextAdapter)this.Context).ObjectContext;
You can use it right after obtaining an entity with a statement like follows:
var order = this.Context.Order.Single(e => e.ID == id);
In the middle of a project you might want to automate DB restoring and upgrading by means of existing SQL scripts which may contain GO-statements. If you are that person who is attempting to execute scripts at runtime with GO-statements, this article describes how to do that.