Archive for '.NET'
WPF MVVM and Showing Dialogs
Published on January 5th, 2010.
Developing a WPF/Silverlight application using the MVVM (Model-View-ViewModel) pattern is a real challenge. But you know that using this pattern you write low-coupled and fully testable code (I hope). As MVVM says, the View can contain only XAML declarations. That is, no code-behind is present in your .xaml.cs file. (more…)
Filled under .NET, Design Patterns, WPF. 1 Comment.
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.
Application Architecture Guide v2 – Free eBook
Published on December 29th, 2009.
Microsoft Application Architecture Guide, 2nd Edition is a Must Have eBook for Developers and Solution Architects. The guide is intended to help developers and solution architects design and build effective, high quality applications using the Microsoft platform and the .NET Framework more quickly and with less risk. It provides guidance for using architecture principles, design principles, and patterns that are tried and trusted. The guidance is presented in sections that correspond to major architecture and design focus points. It is designed to be used as a reference resource or to be read from beginning to end.
The guide helps you to:
- Understand the underlying architecture and design principles and patterns for developing successful solutions on the Microsoft platform and the .NET Framework.
- Identify appropriate strategies and design patterns that will help you design your solution’s layers, components, and services.
- Identify and address the key engineering decision points for your solution.
- Identify and address the key quality attributes and crosscutting concerns for your solution.
- Create a candidate baseline architecture for your solution.
- Choose the right technologies for your solution.
- Identify patterns & practices solution assets and further guidance that will help you to implement your solution.
Filled under .NET, Development Techniques, eBooks. 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.