Im trying to get hibernate running in a webservice with difficulty, during debugging when i get to the line "cfg.AddAssembly("WebService");" everything come to a halt. And it hard to see what the problem is as no errors i shown in the brower.
Any ideas what is the matter? my assembley name and namespace are both 'WebService'.
Code:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using NHibernate;
using NHibernate.Cfg;
namespace WebService
{
/// <summary>
/// Summary description for Service1.
/// </summary>
[WebService(Namespace="http://microsoft.com/webservices/")]
public class DlheService : System.Web.Services.WebService
{
public DlheService()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
[WebMethod]
public Student[] getDLHERecords(string courseCode,string type, string pass)
{
Configuration cfg = new Configuration();
cfg.AddAssembly("WebService");
NHibernate.ISession session = null;
ISessionFactory factory = cfg.BuildSessionFactory();
session = factory.OpenSession();
IQuery query = session.GetNamedQuery("Students.ByCourse");
query.SetParameter(0,courseCode);
IList a = query.List();
Student [] drs = new Student[a.Count];
int i=0;
foreach(Student r in a)
{
drs[i]=r;
i++;
}
return drs;
}
}
}