Monday, March 30, 2009

NHibernate and Sharepoint 2007

NHibernate and Sharepoint 2007

Sharepoint webpart that uses NHibernate to do Database operations.
It was a hard task, spent 2 days fixing deployment errors and assemblies dependencies.

At the end it worked :)

Make sure:
- Hibernate mapping file build action is embedded resource
- Use NHibernate.ByteCode.Castle not NHibernate.ByteCode.LinFu (I donno why!)
- hibernate.cfg.xml and NHibernate.ByteCode.Castle.dll should be in C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin
- NHibernate required libraries put them in the GAC C:\WINDOWS\assembly

5 comments:

AlpesH Shah said...

Hello Sami,

I would like to do something similler with SharePoint and NHibernate. Can you post code of the sample webpart that you were building?

Thanks

Unknown said...

Hi Sami,

What about using fluent nhibernate with sharepoint?

Unknown said...

I'm interested in the code of the webpart too.

In my webpart NHibernate complains he can't find the assembly my domain-object is in.

Hazem Torab said...
This comment has been removed by the author.
Hazem Torab said...

a detailed tutorial on how to run nhibernate on sharepoint 2010 can found here Nhibernate and sharepoint