Archive for 'C#'
NUnit Runner for Visual Studio 2008 and 2010
Published on July 28th, 2010.
Many developers are using TestDriven.net as a test runner. I have also tried it – it’s great! However, it is free only for personal usage. For professional usage, you need to buy a licence. There are many alternatives to running tests. My favorite test framework is NUnit. For running NUnit tests, one may use its GUI tool.
Recently I came accross a new GUI tool for running NUnit tests. It’s (suprisingly
) called Visual NUnit. It is integrated in Visual Studio and provides many features like:
- Easy and fast NUnit test execution
- Easy test debugging
- NET 2.0, 3.0, 3.5 and 4.0 support
- Test execution progress, time and summary
- Stack trace view
- Test filtering based on project, namespace and fixture
Filled under .NET, C#, Testing. No Comments.
New Json.NET is here – smaller and faster
Published on January 4th, 2010.
The latest release of Json.NET has a lot of improvements which make it preferable to other techniques. The team has done really a great job to increase the speed of both serialization and deserialization.
Json.NET is faster than both the JavaScriptSerializer and the WCF DataContractJsonSerializer over all scenarios. It reached the level of the XML based DataContractSerializer which is pretty remarkable. Json.NET over binary (BSON) is considerably faster than the .NET BinaryFormatter, too. Another one of the benefits of JSON is its smaller size when compared to equivalent XML. The output of Json.NET is less than half the size of the XML that DataContractSerializer produces. Read more about these tests on James Newton’s post.
Download the latest release of Json.NET and try it yourself!
Filled under .NET, C#, News. No Comments.
Extending ItemsControl in WPF/Silverlight remark
Published on December 20th, 2009.
Have you ever tried to extend ItemsControl in WPF/Silverlight? I guess the answer is Yes. In many situations you need to create a custom control, which support items. In this case you can use either ItemsControl or ListBox as a base. ItemsControl provides a couple of methods to help you build your items control. Such methods are IsItemItsOwnContainerOverride, GetContainerForItemOverride and PrepareContainerForItemOverride. When you add items to your control these methods are being called to help you manage your items. But have you run is such situation that when you added items these methods were not called? Well, it’s a very strange situation really. Here is you should make sure when you encounter this problem:
- make sure you are extending ItemsControl
- make sure your ItemsSource actually has items
- make sure the control is visible
- make sure you have put ItemsPresenter in the Template of your control
ItemsPresenter specifies where items should be placed, so always make sure you have placed it along other controls in the Template of your items control.
Filled under .NET, C#, Silverlight, WPF. No Comments.
Untie the Connection String from DataContext (LINQ to SQL)
Published on November 27th, 2009.
When you work with LINQ to SQL you probably want your DataContext (and all the entities) to be in its own assembly. It’s a normal decision when developing n-tier applications.
The Problem
When you create your LINQ to SQL classes file (dbml) you have two options for your database connection string:
- In Settings.settngs file of the corresponding assembly
- Hard-coded in your DataContext desginer (.designer.cs file)
Well, when you have a web application or WinForms/WPF application you definitely would like to manage your connection string from the general config file (web.config or app.config). In this situation it would be a little pain. (more…)
Filled under .NET, ADO.NET, C#, SQL. No Comments.
Mapping a Stored Procedure to an Entity with Entity Framework
Published on November 23rd, 2009.
ADO.NET Entity Framework initially generates a 1:1 (one to one) mapping between the database schema and the conceptual schema in most of the cases. In the relational schema, the elements are composed of the tables, with the primary and foreign keys gluing the related tables together. In contrast, the Entity Types define the conceptual schema of the data. One is sure – ADO.NET Entity Framework makes it easy when it comes to work with a database. But is it sure?
Suppose you have created your entities using the Visual Studio 2008 wizard.

Filled under .NET, ADO.NET, C#, SQL. No Comments.

