IQueryable vs IEnumerable vs IHaveHeadache

Yes.. this ist just another blog post about IEnumerable and IQueryable. But the topic is quite important and I think it worth discussing about both approaches. Recently I had a discussion with a software architect about the implementation of the repository pattern. The question was: Should the repository return IEnumerable or IQueryable? So let’s do… Read More »

WCF Configuration for Large Data

In one of our projects we had to transfer large data from the server to the client WPF application. In the beginning we had some performance issues. Therefore we decided to do some comparisons between ASP.NET Web API, WCF (with and without protobuf-net). The configuration: ASP.NET Web API WCF (Protobuf) WCF – Protobuf serializer –… Read More »

C# Code Snippet for Unit Tests

After coding unit tests the whole day, I decided to create a nice Visual Studio snippet which helps me to write the test method quicker. I usually structure my unit tests like this: public void Validate_ReturnsFalse_WhenStringIsTooLong() { // Arrange var expectedResult = false; var watheverMock = new Mock<IWathever>(); // Act var validator = new Validator(watheverMock.Object);… Read More »

Entity Framework and Expression Queries

In my current project I had to generate a Entity Framework query based on some search criterias defined in a dictionary. The structure of the dictionary was similar to this example here: var searchCriteria = new Dictionary<string, List<string>>() { { "FirstName", new List<string> { "Darko", "NoName" } }, { "LastName", new List<string> { "Micic", "Müller",… Read More »

F# Journey: Course 3 – Functions

Back to: F# Journey: Course 2- Type Inference The concept of a function exists is in F# too. However, it’s slightly different than in C#. A F# function has a name, list of parameters and a return value. The function itself is assigned to a value with the “let” keyword. The parameter types are inferred… Read More »

F# Journey: Course 2 – Type Inference

Back to: F# Journey: Course 1 – Immutable Values You probably know type inference already from C#. But in F# it’s like magic! You don’t have to define the type quite often. The compiler will automatically find out. Let’s start with some examples: let a = 1 // or let plus a b = a… Read More »

My F# Journey

After working 4-5 years mainly with object-oriented programming languages like C#, I thought it’s a good time to dive into other programming paradigms. For example: Functional programming -> F#! Based on the “Indeed Trends” (see at the bottom of this post) we see that the market is still not seeking a lot F# or Scala… Read More »

F# Journey: Course 1 – Immutable Values

Back to: F# Journey By default all variables in F# are immutable. Hence.. we can not call them “variables” anymore. The term “value” fits better. Here is a simple example of an immutable value: let val1 = 2 printfn "%d" val1 Now when you try to change the value like in the code below (line… Read More »