Here are my files...
App.config
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="FirebirdSql.Data.FirebirdClient" fullName="FirebirdSql.Data.FirebirdClient, Version=2.5.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
</assemblyBinding>
</runtime>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.FirebirdClientDriver</property>
<property name="connection.connection_string">Server=localhost;Database=C:\PATIENTS.FDB;User=SYSDBA;Password=masterkey</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.FirebirdDialect</property>
<property name="command_timeout">60</property>
<property name="query.substitutions">true 1, false 0, yes 1, no 0</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
<mapping resource="MyNH.Patients.hbm.xml" assembly="MyNH" />
</session-factory>
</hibernate-configuration>
</configuration>
Patients.cs
Code:
using System;
using System.Collections.Generic;
using System.Text;
namespace MyNH
{
class Patients
{
private int pID;
private string fName;
private string lName;
private string tel;
private string email;
private string addr;
private char gender;
public Patients()
{
}
public int PID
{
get { return pID; }
set { pID = value; }
}
public string FName
{
get { return fName; }
set { fName = value; }
}
public string LName
{
get { return lName; }
set { lName = value; }
}
public string Tel
{
get { return tel; }
set { tel = value; }
}
public string Email
{
get { return email; }
set { email = value; }
}
public string Addr
{
get { return addr; }
set { addr = value; }
}
public char Gender
{
get { return gender; }
set { gender = value; }
}
}
}
Program.cs
Code:
using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Cfg;
namespace MyNH
{
class Program
{
static void Main(string[] args)
{
Configuration cfg = new Configuration();
cfg.AddAssembly("MyNH");
ISessionFactory factory = cfg.BuildSessionFactory();
ISession session = factory.OpenSession();
ITransaction transaction = session.BeginTransaction();
Patients newPatient = new Patients();
newPatient.PID = 4;
newPatient.FName = "r";
newPatient.LName = "i";
newPatient.Tel = "1234353454";
newPatient.Email = "ri@gmail.com";
newPatient.Addr = "Malabe";
newPatient.Gender = 'F';
session.Save(newPatient);
transaction.Commit();
session.Close();
}
}
}
I'm getting an error at "cfg.AddAssembly("MyNH");" line in "Program.cs"
error : Could not compile the mapping document: MyNH.Patients.hbm.xml
innerException: Could not instantiate dialect class NHibernate.Dialect.FirebirdDialect
I have added "FirebirdSql.Data.FirebirdClient.dll", "Iesi.Collections.dll", "NHibernate.dll" and "LinFu.DynamicProxy.dll" as references.
Thanks for any help.