Hello,
I'm working with Nhibernate via VS .NET 2003. I created a project and all operations works fine( Insertion, delete,select, update) And now i m trying to create a library which those functions, to call them from outside just by adding reference to MyLibrary.dll.
So i created a class test in another project and i added reference to MyLibrary.dll.
All show u an example with Insertion function :
Code:
using System;
using System.Collections;
using NUnit.Framework;
using NHibernate;
using NHibernate.Cfg;
using EquipMapLib;
//using ByteFX.Data.MySqlClient;
namespace EquipMapLib
{
public class Insertion
{
public Insertion()
{
}
public void InsertEquipement(Equipement Equip)
{
try
{
Configuration cfg = new Configuration();
Console.WriteLine("totototototototot");
cfg.AddAssembly("EquipMapLib");
cfg.AddXmlFile("Equipement.hbm.xml");
ISessionFactory factory = cfg.BuildSessionFactory();
ISession session = factory.OpenSession();
ITransaction transaction = session.BeginTransaction();
session.Save(Equip);
transaction.Commit();
session.Close();
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
throw ex;
}
}
public void InsertEquipement2(int id,int local,string nom,string modele,string marque,string noserie,string commentaire,string description,string snmp)
{
Equipement Equip = new Equipement(id,nom, modele, marque, noserie, commentaire, description, snmp,local);
InsertEquipement(Equip);
}
}
}
The test :
Code:
using System;
using System.Collections;
namespace EquipMapLib
{
public class Test
{
public static void Main(string[] args)
{
try
{
int i=18;
Equipement Equip = new Equipement(i,"toto","modele","Marque","noSerieie","Commentzire","Decriptiorkg","snmdk",45);
Insertion insert = new Insertion();
insert.InsertEquipement(Equip);
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
I got the following errors :
Code:
log4net:ERROR DOMConfigurator: ConfigureFromXML called with null 'element' para
eter
totototototototot
The dialect was not set. Set the property hibernate.dialect.
The dialect was not set. Set the property hibernate.dialect.
Press any key to continue
and in debug mode :
[code]'DefaultDomain'