Category: .NET

Razor with JavaScript

Today I had a problem of adding markers onto a google map. I didn't really want to create a service to handle the request and return an array. So instead I tried doing something simpler.

This obviously didn't work. Razor was getting confused; it didn't know which one was the script and which one

Continue Reading

MVC File Upload - Access to the path is denied

An interesting problem occurred yesterday when I was trying to upload a file to the server. I was getting: Access to the path '' is denied The problem wasn't actually caused by the file upload but by my attempt to create a directory to put that file there. After reading a bunch of answers on

Continue Reading

ASP.NET Automatic Migrations

Understanding migrations can be a bit tricky. Hopefully, this article will resolve at least some of the questions you might have. First things first - What are migrations? Well... If you built your website using first code approach every time you change your model you need in order to keep the database in sync. There

Continue Reading

Mapping to a new new Type with ASP.NET Web API and LINQ

As you would expect Microsoft is trying to make your code as clean and need as possible. This is an example of a search query. The key element of this query is select new {Title = m.Name}. It allows you to map a your model to a new type without having to declear a custom

Continue Reading

Publishing WCF Web Service on IIS

Today, I will show you how to to publish WCF Web Service on IIS. I assume your have a working version of your WCF on IIS Express and you want to "publish" it. Step 1 - Install IIS Go to: Control Panel Programs and Features Turn Windows Features On and Off There are 4 things

Continue Reading

Image FadeOut Animation

Today, I decided to play around with WPF a little bit. I created a simple App for animating a logo

Continue Reading

Setting default value for property in EF Code First

There few ways in which one can do it. The simplest way is via data annotations:

Continue Reading

The Output window in VS 2013

I accidentally closed the output 'window' in my VS 2013. I cannot believe it took me that long to find this, but hopefully it will save you some time:

Continue Reading

"using", the safe keyword

Frequently, we don't really care what the exception is, but if it is thrown we want to finalise operations e.g. close the database connection or files. This is where using comes in. using keyword allows to make code a little bit more readable by omitting try-catch-finally clause. Instead, your object should implement IDisposable interface and

Continue Reading

Neat way of getting rid of nullable type in Linq

Nullable types can sometimes be a handful to work with. This 'billion dollar mistake' (as described by Tony Hoare who claims to have invented null) can, however, be convereted to r There is a need way of converting nullable type: ??. The example below selects some value from an object using Select method. YourVariable is

Continue Reading