.net (23)


Resharper vs JustCode vs CodeRush

In case you wonder: Resharper wins hands down. During my last contract, the devs godsent tool (read Resharper) wasn’t available for some reasons (read £££), so I decided to try out the 1 month evaluation offered by each of its main competitors. But not before first trying Resharper itself (one month trial here too), so here’s the conclusion: […]




Expect 100 timeout on WS calls.

Noticed that a service call was timing out on a new project while the same call was fine on an older project. By comparing the requests in Fiddler I noticed that the failing one was adding Expect: 100-Continue to the header. Adding the following to the web.config fixed it:




Fluent interfaces introduction and sample.

Learning how to write a fluent interface can help when you want to write the next ORM or if you just wonder how to concatenate your methods in a LINQ style. I’m particularly interested in using this technique to write Html helpers. Anyway, let see a basic example. A simple calculator class/interface , using a […]




Easy join tables with EF Code First.

Entity Framework Code First is getting even better, release after release. Here’s how to easily get a many to many relationship between two entities. Not to much to do really, once the relationship is specified within the two classes (an ICollection navigation property for each of the two ends in the relation), EF will take […]




Default value if null object in an extension method.

Sometimes you need to get a value from a nested object and in order to do it we need to be sure that the object hierarchy do not have any null objects in it. This lead to a long series of checks. Here an example, assuming we got these entities: Code Snippet   public class Country […]




Developer homework test.

Below you can find a test I received via email long time ago. Also, in this attachment there’s what I think is a good solution, any tough or suggestion is appreciated ! Developer Homework Please write code to fulfill the requirements of the following user stories. We are looking for answers that demonstrate good test […]




Ignore all non exisisting properties with Automapper

Code Snippet public static class MappingCustomExtension {     public static IMappingExpression<TSource, TDestination> IgnoreAllNonExisting<TSource, TDestination>(this IMappingExpression<TSource, TDestination> expression)     {         var sourceType = typeof(TSource);         var destinationType = typeof(TDestination);         var existingMaps = Mapper.GetAllTypeMaps().First(x => x.SourceType.Equals(sourceType) && x.DestinationType.Equals(destinationType));         foreach (var property in existingMaps.GetUnmappedPropertyNames())         {             expression.ForMember(property, opt => opt.Ignore());         }         return expression;     } }




LuceneWrap write.lock FIX

After getting a feedback on an article I’ve posted time ago on Codeproject I’ve updated the source code in order to fix an appended lock created after a search.  I’m posting here the project because the article is approved on Codeproject and to get it changed I’ll need to contact the staff, wait, post the […]




MVC Radiobutton group

In order to group a series of radiobutton and allow only one control of the group to be selectable we’ll have to set the same value for the “name” attribute on all controls of the group. In Vb.Net Code Snippet <div id="group1">     @Html.RadioButton("group1", False, New With {.class = "radioClass"})     @Html.RadioButton("group1", False, New With {.class = […]




From Asp.net Webforms to Asp.net MVC

I’ve been using MVC recently for a while now, both at work and on my own, I am really enjoying it, the implementation proposed by Microsoft is simple and effective and it sticks more to the nature of a web session(request/response) than the Webform model with all it’s page lifecycle, control events and so on.  […]