If you live in Marche (Italy), get ready and don’t miss the next DotNetMarche workshop! Our local community group is working to setup the event. You can see the actual agenda and register for it at: http://dotnetmarche.org/eventi/Default.aspx?IDevento=33.
We will have an ‘all around’ event on WPF from a basic introduction to some advanced patterns for building application (MVVM and UI composition), plus - for those who last till the end - some nice features like 3D and Naturally User Interfaces.
This time will also be a ‘cross-community’ event, the speakers will be:
These days I’m working to improve the startup time of an application my company develop, using some profiling tool you can easily isolate that functions that are eating up more time during the application startup.
Aside the database connections, I’ve saw that our custom protection and registration system was consuming more or less 3 seconds (it varies each run in the range from 2.5 to 3.5 seconds) to generate a unique hash code for the machine on which the program is installed.
The code internally uses some WMI queries to pickup system and hardware information, the first run was something like this:
One of the functions that is used to generate part of the hash requires 2.6 seconds to run...which is unacceptable to gather some hardware information.
All those functions basically use some WMI queries to get the data we need the implementation was something like:
Recently I’ve started to play with Linq to NHibernate and I have to say it work pretty well for the scenarios I’m facing. It also helped me to ‘re-learn’ some things on NHibernate I usually forget.
Let’s consider the case in which we have a class that have some properties without setters, the usual way to map them is using the access=’field’ modifier and tell NHibernate to not use the property by the internal field of the implementation; you can then write your HQL queries on that field, here’s an example:
Some days ago I blogged about how you can build your own Custom WCF Proxy generator to extend the classes it generates and add some validation logic (or whatever you like).
Well playing with the MusicStore sample and making some changes to my domain classes there I’ve found a bug in the previous version of the proxy generator, let’s say your domain classes are like these:
For all my Italian readers (especially all that reside in Marche) these are the last few days to sign up and participate at our last workshop of the year.
The technical sessions will be devoted to the technologies you can use TODAY to write a web application, focusing especially on the UI.
We decided to create our own MusicStore sample and build it ground-up with 3 different technologies: Asp.Net classic / Asp.Net MVC + jQuery / Silverlight 3.
The Silverlight version of MusicStore will also use the following technologies:
The server side components will use a SQL Express + NHiberante for the data access layer
WCF service / HTTP handler : this is the ‘data provider’ of the application to deal with the database and upload files
Silverlight 3 for the UI.
We will focus on some feature related to UI building (and patterns if we have time), I’ll show you how to use:
Data binding - for displaying and acquiring data
Validation - how you can do preventive validation on the UI
Control Temples - to skin and change the appearance of control without touching the code
Here are some screenshots of the working application:
Using the control templates provided by the Silverlight toolkit I just noticed that those style do not support the validation states for displaying validation errors.
Since you have access to the templates adding them is a quite easy - but boring - job. First of we need to open the template of the standard controls and extract the pieces related to data validation display, then we can modify the provided templates inserting these pieces of code back. We can do this so easily because of the nice way the controls skins work in Silverlight and WPF (there are plenty of resources over the net on this subject so I will not dig into that) and thanks to the Visual State Manager that handles the display state changes without any logic to be added to the control, this link from Jesse Liberty gives a clear picture of the thing: Quick overview of Silverlight validation.
In short to modify the - let’s say - the Textbox template you just have to:
Look for the VisualStateManage.VisualStateGroups section of the template and add a VisualStateGroup with the following states in it: Valid, InvalidUnfocused, InvalidFocused. All the data validation framewrok relies on the presence of these 3 states do change the appearance of the control: