can any one help me.....?
-------------------------Guitar.cs-------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NHibernate.GuitarStore.Common
{
class Guitar
{
public virtual Guid Id { get; set; }
public virtual string Type { get; set; }
IList
}
}
-------------------------Inventory.cs-------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NHibernate.GuitarStore.Common
{
internal class Inventory
{
public Inventory()
{
}
public virtual Guid Id { get; set; }
public virtual Guid TypeId { get; set; }
public virtual string Builder { get; set; }
public virtual string Model { get; set; }
public virtual int? QOH { get; set; }
public virtual decimal? Cost { get; set; }
public virtual decimal? Price { get; set; }
public virtual DateTime? Received { get; set; }
}
}
------------------Guitar.hbm.xml---------------------------
-------------------Inventory.hbm.xml-------------------
-------------------------------------NHibernateBase---------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Cfg;
using System.Threading.Tasks;
namespace NHibernate.GuitarStore.DataAccess
{
public class NHibernateBase
{
private static Configuration Configuration { get; set; }
protected static ISessionFactory SessionFactory { get; set; }
private static ISession session = null;
private static IStatelessSession statelessSession = null;
public static Configuration ConfigureNHibernate(string assembly)
{
Configuration = new Configuration();
Configuration.AddAssembly(assembly);
return Configuration;
}
public void Initialize(string assembly )
{
Configuration = ConfigureNHibernate(assembly);
SessionFactory = Configuration.BuildSessionFactory();
}
public static ISession Session
{
get
{
if (session == null)
{
session = SessionFactory.OpenSession();
}
return session;
}
}
public static IStatelessSession StatelessSession
{
get
{
if (statelessSession == null)
{
statelessSession = SessionFactory.OpenStatelessSession();
}
return statelessSession;
}
}
public IList
{
using (ITransaction transaction = Session.BeginTransaction())
{
try
{
IList
transaction.Commit();
return result;
}
catch (Exception ex)
{
transaction.Rollback();
throw;
}
}
}
}
}
-------------------------------Calling Here--------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NHibernate.Cfg;
using NHibernate.GuitarStore.DataAccess;
namespace NHibernate.GuitarStore.Console
{
class Program
{
static void Main(string[] args)
{
try
{
NHibernateBase NHB = new NHibernateBase();
NHB.Initialize("NHibernate.GuitarStore");
System.Console.WriteLine("NHibernate.GuitarStore assembly initialized.");
System.Console.ReadLine();
}
catch (Exception ex)
{
string Message = ex.Message;
if (ex.InnerException != null)
{
Message +="-InnerExcepetion: " + ex.InnerException.Message;
}
System.Console.WriteLine();
System.Console.WriteLine("*****ERROR*****");
System.Console.WriteLine(Message);
System.Console.WriteLine();
System.Console.ReadLine();
}
}
}
}

Replies
Know the answer? Post it — somebody with the same question will find it here.