In this short post I will show you how you can easily test your MVC routes using Fakes as mocking framework. Besides there is a lot of mocking frameworks you can choose to unit test your code, Fakes provides you the ability to mock almost any class within the framework, not just interfaces or virtual... read more
Lately I’ve been working with ASP.NET Web API and I had to solve a couple of issues regarding data validation when sending a request to the API. Problem #1 When exposing an operation that receives several optional parameters (i.e. to perform a search), sending invalid parameters will not be detected by the API. Example: Given... read more
Continuing with my incursion in the NoSql database world, these days I’ve been playing with Couchbase installed on Windows 8 (after tackling several issues). Finally, after downloaded and installed it successfully, I’ve created a simple console application in C# to test its basis (as I did in my previous articles ‘Using MongoDB from C#‘ and ‘A little of... read more
Hi, a few days ago I published an article showing how you can easily use MongoDB under C#. In this article I mainly plan to show the same operations or features, but using RavenDB. As this database is built in C# it will be easier to integrate it a native C# client. Besides both databases have very similar... read more
Today I’ve been playing a little with MongoDB, and after enjoyed triggering a few commands from Mongo’s console, I decided to download, build and try the C# driver. Build it and use it is pretty straightforward, and in a couple of minutes you can be playing with your local database from a C# console application. So I... read more
Recently I’ve been working with NHibernate, and besides configuring trivial mappings, I had to deal with some not so trivial: when I wanted to link to tables using an alternative key between them. In this short post I’ll resume the necessary steps to do this in case you need to do it too (in a... read more
During the last weeks I’ve been working in an application that uses Entity Framework (code-first) and I had a performance-related issue that I thought worth sharing. After implementing some features in the app I noticed some performance issues, so I decided to add MiniProfiler and see how things were going under the hood. The cause... read more
Lately, I’ve been working with the P&P group and something came up requiring to do Data Extensibility within Azure Table Storage. As this storage model is different to traditional DB schemas, we’ve found a similar approach relying on reflection and continued using the Microsoft.WindowsAzure.StorageClient assembly provided by Azure’s SDK. The problem to solve is how... read more
Hi everyone, This time I wanted to show the research we made with my colleague David Frassoni about recommendations and tips when handling exceptions and validations in C#. When to Throw an Exception We should not throw exceptions for every erroneous event. For example in an application in which we want to get a list... read more
Microsoft Codename “Trust Services” lets several parties to encrypt/decrypt data over shared resources according to policies determined by an Administrator, where none of the parties have direct knowledge of the encryption key which is managed by a Trust Server. The Administrator, via an X509 certificate uploaded while provisioning a Trust Server, is the only one... read more