Introduction
Sqlite
SQLite is a file based database, or an embedded database that you can use without need for any special installation from your side. It’s a bit popular for non-LOB (line of business) desktop applications and even mobile applications like Android apps. It also has an "In-Memory" mode where there is no physical file used as a database, which is usually used in testing.
It has a similar syntax (sort of) to SQL Server. In Microsoft .NET world,, those using NHibernate are usually using the in-memory mode for applying unit testing or trying out NHibernate stuff, although Microsoft has its own embedded database called SQL Compact Edition (CE), which doesn’t seem to support in-memory databases (v4.0).
You can download the latest Sqlite database (v3.0) from:
http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
Since it’s not SQL Server, you need a special ADO.NET provider too. It’s called "System.Data.Sqlite"., which is very similar to the normal System.Data.SqlClient stuff. It’s included in the above download link.
NuGet
If you don’t know what NuGet is, go to www.nuget.org or check my old posts mentioning it, or if you are an Arab maybe check this post in Arabic.
Read the full post ... (1374 words, 7 images, estimated 5:30 mins reading time)
.NET, .NET FAQ, Miscellaneous, NHibernate, ORM
This article is the third in a series of articles not written by me, but by José F. Romaniello. He is a big NHibernate guy, so, he created a sample domain trying to evaluate how close the latest Entity Framework 4.1 Code First stuff is getting to NHibernate features,
Later, he chose to show how to do the same Code-First mapping using NHibernate and confORM, NHibernate mapping library that is created by Fabio Maulo, a primary developer in NHibernate source code.
I asked him to do it also with FluentNHibernate, so, he took the time and effort to create a nicely put visual studio solution. at some point he gave it to me as I was familiar with FluentNHibernate in general, not with automapping, which we wanted to use for this sample. so, I am now posting about this experiment.
This article’s very late than it should. Apologies to those who have been waiting.
Convention Based Mapping, AKA, Automapping
My audience is slightly different than Jose, I might need to explain this one. skip if not needed.
Read the full post ... (2298 words, 7 images, estimated 9:12 mins reading time)
Code Reading, Code Snippets, FluentNHibernate, NHibernate
If you don’t know what is NuGet, please skip to the end first
NHibernate Package
For some time NHibernate 3.0 package on Nuget was listed as owned by Fabio Maulo (@fabiomaulo), a main comitter to NHibernate, but was not owned by him until NHibernate 3.1 came out and there was a need to upgrade the package, which happened today.
You can find NHibernate package on Nuget by searching for the word NHibernate in the gallery, or going to the package page directly on :
http://nuget.org/List/Packages/NHibernate
Do Not Install This Package Directly
However, in this page (or summary pane in Nuget tool in Visual Studio when you select the package, you’ll read:
DONT INSTALL IT DIRECTLY Only as reference for others frameworks. NHibernate is a mature, open source object-relational mapper for the .NET framework. It’s actively developed , fully featured and used in thousands of successful projects.
Why Is That?
The reason for that is that NHibernate requires using something called a proxy factory. This is the tool that creates proxies of your entities (usually in runtime) for things like Lazy Loading to work. NHibernate has built-in support for those proxy factories, Castle Dynamic Proxy, .LinFu Dynamic Proxy, Spring AOP Framework.
Read the full post ... (1242 words, 7 images, estimated 4:58 mins reading time)
NHibernate, NuGet, Visual Studio 2010, Visual Studio Add-ins
In NHibernate there is a Save(entityObject) method, which creates a new row in the database with the given entity object, also, has an Update(entityObject) which updates the row corresponding to the entity object with the property values of this object. It also has a SaveOrUpdate(entityObject) method, which checks the whether the entity object corresponds to an existing row in the database, and chooses whether to call Save(…) or Update(…) based on that.
The way I usually do web applications across multiple tiers, when not using view models specifically, makes me encapsulate much code in Services layer that sometimes does not need to care about whether the given entity is persisted in database or not. Thus wanted to have similar method using Entity Framework as ORM.
Of course I have implemented the method number of times and the code evolved based on which version of Entity Framework I’m coding against, and my knowledge of the framework internals as well. Actually, when you work with so many ORMs like I did, a new ORM or ORM version turns to only sound like “What’s new in the manual?” thing.
Read the full post ... (822 words, 2 images, estimated 3:17 mins reading time)
.NET, .NET FAQ, ADO.NET, C#, Code Snippets, Entity Framework, NHibernate
My first DotNetwork Cairo Code Camp in 2009 was a great experience, because it was one of the biggest events I’ve spoken at (in terms of audience count, similar to SilverKey Demo Day II). However, Cairo Code Camp `10 had a much different taste!

Not just that I met Scott Hanselman, one of the most popular Microsoft guys, and hold him down as you see in the picture (which I’ll never forget), the great person and popular guru…

Not just that I met so many great other speakers, many of them are my friends and some of my friends talking for the first time in such event or after long pause…

But also because we all (speakers and organizers – both volunteers) met so many great attendees. Some of them were interesting people I’ve followed on Twitter for some time and haven’t seen them yet. Some of them were old lovely faces that we meet very rarely (especially I no longer work in Egypt). Some of them were totally new faces, bringing a lot of ideas and very useful discussions….
Read the full post ... (680 words, 8 images, estimated 2:43 mins reading time)
CodeCamp, CodeCamp '10, dotNETwork, jQuery, Local Events, NHibernate, ORM, Web 2.0, Web Design