Tagc#

Entity Framework migrations – names are case sensitive

E

In a rush, I’d called my migration “vendorServiceKEy” Which had resulted in my migration being named 201512102031458_vendorServiceKEy I then ran migrations with update-database. Now, when I renamed the class manually, to sort out my OCD, the next time my application ran, I got There is already an object named xxx in the database My _MigrationHistory table contained the following...

Could not load file or assemebly ‘ceTe.DynamicPDF.Rasterizer.40.x86.dll’

C

I ran into this issue when deploying an application that uses the DynamicPDF Rasterizer. After emailing support, who got back to me within the promised 24 hours, they offered some good suggestions. The solution for me was to use the installer provided on their download page, which in turn installs the pre-requisites (Visual C++ distributable) Secondly, I changed the reference in my project to the...

Dynamic routes with ASP.net MVC – Category/Location mapping to controller

D

I’ve recently been looking in to building a directory type application with Asp.Net MVC One of the requirements would be to have SEO friendly URLs such as: —Surrey /restaurants being the “Category” /Camberley—Surrey being the “Location” So, I created a ‘CategoryController’ like this public class CategoryController : Controller { public ActionResult Index(string category, string location) { //do...

Managing multiple MongoDB C# class maps – Part 1

M

I’ve used MongoDB with several net projects over the last few years, and one thing that has in the past frustrated me is the way BsonMapping  is set up. This once per app setup can get pretty long, complex and hard to follow. As per the documentation this, on the face of it,  it’s fairly easy: BsonClassMap.RegisterClassMap() Which will automap MyClass. Note – There is no actual...

Unit tests failing when run all together with FakeItEasy

U

While running my tests, I noticed that if I ran my test suite all together, some would fail, giving the exception: API restriction: The assembly has already loaded from a different location This issue was happening both in ReSharper test runner, and using the NUnit test runner Debugging, the exception was being thrown on my SetUp methods like: [SetUp] public void SetUp() { _myFake = A...