NHibernate static proxy

It's been a long time (06/24/2011) I pushed my last commit on my GitHub project NHibernate.StaticProxy, and I notice only now that I even didn't speak about this project on my blog... Shame on me! So after a short delay (hum...), here it comes

post-12-081001400 1377666739

W3 Total Cache and Google XML sitemap

This is a small post to explain how to make the Google XML SiteMap plugin work fine if you have installed W3 Total Cache too. I chose not to talk about this in my previous post, about the migration from DotClear 2 to WordPress 3, because I think this would be more easy to find…

Migration to WordPress

This was a long time I wanted to get rid of my old blog, which was running using DotClear, to replace it with a WordPress instance. There are not a lot of reasons for that. The main one being the number of themes and plugins which is far more substantial on the latter platform. I…

Some news...

Wow... Looking at the date of my last post, I'm surprised to see it is more than one year ago... Some much things happened to me since march 2011. But only one could explain the severe lack of updates over here: I've changed my job. To be honest, this was not a planned move. The…

[CaliburnMicro] Dependencies attribute on any depth level of properties

I didn't post anything on the blog for a very long time (2010-12-07), so let's break the silence with something new about Caliburn Micro.

In this post, I will briefly show you an update of an "old" article I wrote. The main drawback of the previous version of this dependencies attribute was its inability to make the availability of the action depend on more than one level.

For example, you could write these dependencies, which update the availability of the Do method when either OtherProperty (a property of the same view-model than Do) or OtherProperty.ChildProperty were modified.

[code lang="csharp"][Dependencies("OtherProperty", "OtherProperty.ChildProperty")] public IEnumerable Do() { }[/code] With the new Dependencies attribute I'll show you right after the break, you won't be limited to this single level of hierarchy, thus allowing you to write a dependency like:

[code lang="csharp"][Dependencies("OtherProperty.ChildProperty.OneMoreLevelProperty.LastLevelProperty.*")] public IEnumerable Do() { }[/code]

[PostSharp] Ease the creation of configuration sections

In this article, I'll show yet another use of PostSharp, this time focusing on the ConfigurationSection class. If you look in the MSDN at the articles which explain how to use the ConfigurationSection, you may have noticed that the code you need to write is repetitive, tedious, and error-prone:

[code lang="csharp"]public class PageAppearanceSection : ConfigurationSection { [ConfigurationProperty("remoteOnly", DefaultValue = "false", IsRequired = false)] public Boolean RemoteOnly { get { return (Boolean)this["remoteOnly"]; } set { this["remoteOnly"] = value; } } [ConfigurationProperty("font")] public FontElement Font { get { return (FontElement)this["font"]; } set { this["font"] = value; } } [ConfigurationProperty("color")] public ColorElement Color { get { return (ColorElement)this["color"]; } set { this["color"] = value; } } }[/code] As you can see, you have to put the ConfigurationPropertyAttribute on top of each property, and to make calls to an indexer to the Get and Set methods of the properties, using the same name you used in the attribute.

Doesn't this repetition look like to be a good candidate for an aspect?

[PostSharp] [Caliburn] Automatic IEventPublisher subscription and publication

If you develop in WPF using the MVVM pattern, you have certainly heard about the Event Aggregator pattern, which allows, as the MSDN says:

decoupling of publishers and subscribers so they can evolve independently.

There are several implementations of this pattern:

Of course, as the title of this article told you, we are going to use the latter, and I will propose an implementation of a PostSharp aspect which will help us to subscribe to events, publish them, and dispose the subscriptions when the view-model is deactivated.