I have complied all nhibernate code in a dll.
MF2BO.XML.allClients.hbm.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="MF2BO"
assembly ="MF2BO" >
<class name = "allClients"
mutable = "false"
table= "[dbo].[allClients]"
>
<composite-id
>
<key-property
name="contactID"
column="`contactID`"
type="System.Int32"
>
</key-property>
<key-property
name="Name"
column="`Name`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="address"
column="`address`"
type="System.String"
length="100"
>
</key-property>
<key-property
name="city"
column="`city`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="country"
column="`country`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="sex"
column="`sex`"
type="System.String"
length="1"
>
</key-property>
<key-property
name="state"
column="`state`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="email"
column="`email`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="phone"
column="`phone`"
type="System.String"
length="15"
>
</key-property>
<key-property
name="mobile"
column="`mobile`"
type="System.String"
length="15"
>
</key-property>
<key-property
name="company"
column="`company`"
type="System.String"
length="50"
>
</key-property>
<key-property
name="remark"
column="`remark`"
type="System.String"
>
</key-property>
</composite-id>
</class>
</hibernate-mapping>
hibernate.config.
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="nhibernator">
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">data source=saf-laptop\sqlexpress; initial catalog=E:\WEBSITES\MF2\APP_DATA\SHARIQUE.MDF; user id=sharique; password=sharique;Connection Timeout=10;persist security info=True;</property>
<property name="show_sql">true</property>
<property name="prepare_sql">false</property>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="use_outer_join">false</property>
<property name="isolation">ReadCommitted</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<mapping assembly="MF2BO" />
</session-factory>
</hibernate-configuration>