Chorn Sokun's Weblog

Conquer inner fear, push it to the limit!

Archive for January 2009

Storm The Castle

with one comment

I hope Ayende won’t mind if I steal the name :D well, he did used that name for one of his sample project. Anyway let me throw some good news out to all of my blog trackers “who loves coding :D” I just check-in a sample project using Castle minutes ago.

As I am not sure how many of you understand what I am blogging about or even had trouble try to replicate my trip. Now I make it simpler if you want to catch-up or debate with me on my future Castle posts you got a chance to start it  now just go grab a stick and stone from

If you have any question/suggestion/request you can post it on the project site I am happy to help it out as time allow ;)

Oh by the way this is my 100 posts :))

Happy Chinese New Year everyone.

Written by Chorn Sokun

January 24, 2009 at 11:59 am

Missing AR

with 5 comments

Part of my new year resolution was to get rid off AR from my application architecture design replace it with pure NHibernate. But since AR had been my tool of choice for almost a year or so it just keep haunting me every now and then.

I believe the feature of AR that I am going to talk about is pretty old but somehow useful for certain situation; so let see.

Say you have to deal with User & User’s Roles scenario. A user can play many roles isn’t she? Now pretend you are a lazy developer / no because your DBA was lazy to create a Role, UserRoles table for you :) I know, I know I don’t think this will happen in the real world, your DBA can’t be that naughty :D but anyway one in a while if you were like me learn and love IPrincipal interface everytime I setup a User class you know that the IsInRole(string) will smile at you if it had to deal with Role stored as array of string.

public class User {

   public virtual int Id { get; set; }

   public virtual string Name { get; set; }

   public virtual string[] Roles { get; set; }


No hack, No tweak simply sweet how can’t I miss the AR ;)

Written by Chorn Sokun

January 6, 2009 at 5:58 pm