Chorn Sokun's Weblog

Conquer inner fear, push it to the limit!

Archive for the ‘NHibernate’ Category

.NET Database Application Development (C#)

leave a comment »

If you are interested in .NET and want to jump start with Database Application Development in no time here is your chance

Lady & Gentlemen, boy & girl I present you a .NET Database Application Development (C#) fast track with the following content:

  1. C# Programming Introduction
  2. Introduction to NHibernate .NET Object Relational Mapping (ORM)
  3. Advance Data Processing with NHibernate Criteria API
  4. Hand-on practice

At the end of the course your will learn tools & technique to develop database application which could talk various Database Management System (DBMS) from Microsoft Access, Microsoft SQL Server, MySQL you name it.

Now the truth about doing this in no time :D I lie :-P I need minimum 10 hours before I can transform a newbie into a .NET Database Application Development (C#)


  • Basic Programming Concept
  • Know basic C# Programming
  • Be able to read and understand this blog post – otherwise get yourself English tutor

If you, your friend interested or your employer got budget to develop your capacity drop me a line I would love to hear about it ;)

Written by Chorn Sokun

December 5, 2010 at 4:36 pm

Ubuntu (NHibernate Mono MySQL) Take 2

with one comment

In my previous post I am talking about the setting mono, Nhibernate and MySQL stack on Ubuntu, it was a fun experience. However I made a mistake since I didn’t intend seriously use mono at the time I just wipe the whole os off my laptop and boom all the sample code and assembly gone too. But guess what this time I did it again with the combination of

  • Nhibernate 3 (beta build from trunk)
  • ConfORM (just so I don’t have to worry about .hbm.xml files)
  • MySQL driver install via Synaptic Package Manager (cuz I’m a bit lazy this time)

Now see what I got:

SchemaExport in Action ;)

And of cause I do make the sample code & assembly accessible at .

Written by Chorn Sokun

October 19, 2010 at 9:43 pm

Posted in Mono 2.6, NHibernate, OSS, Ubuntu

Tagged with ,

(N)How simple could that be?

with 2 comments


Wonder how this report get produced from model above it? If you guess was

  • NHibernate
  • MR (did you say <table>?)

You right and I must say I finally master the NH Projection skill or in another word (stealling from JXII) level up!.

What I did by taking AreaCode as primitive data connect it through and transform set of progress records into columns pretty cool trick, no NH hack is required it all natural.

Happy Projections day

Written by Chorn Sokun

May 29, 2009 at 12:19 pm

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

Many to many lazzziii

leave a comment »

I scratched my head for a few hours reading between the line of the following code

DetachedCriteria filter = DetachedCriteria.For(typeof(Project))
  .Add(Expression.Eq("ID", pid))

DetachedCriteria q = DetachedCriteria.For(typeof(List_Output), "op")

ISession s = holder.CreateSession(typeof(List_Output));
IList result;

  result = q.GetExecutableCriteria(s).List();

Wonder why It generate so many sql call to the server? the domain objects in discussion are Project which belong to a Type and base on selected Type a project can choices a bunch of Outputs.
So Project is belong to a Type [One-to-Many], and Type has many Outputs where Output belong to Many Types [Many-to-Many].

After a while I found the issue and got it fixed “it is the Lazzzzzzzziiiiiiiiiiiiiiiines” configuration :))
I forgot to tell Type to load Outputs in a Lazy mode and vise versa, once configured I got only one YEAH ! I mean ONE (a single) sql call to the server instead of 2 + N (where N is number of relevant Outputs in a Type)

Thanks to DetachedCriteria & the Laziness until next time don’t forget the magic word is “Lazy = true”

Written by Chorn Sokun

April 23, 2008 at 3:22 pm

Woh Woh storedprocedure no more …

leave a comment »

Read the title and want to know how to do that? come with me hacking the Castle code base or to be accurate hack NHibernate code base, what you need to bring along? not much but a SubVersion, NAnt, MbUnit and NUnit that sound enough ;)

Enjoy plug & play your database and let the Jedi rise
Happy Friday everyone !

Written by Chorn Sokun

April 18, 2008 at 3:48 pm