All pastes #266462 Raw Edit

Someone

public text v1 · immutable
·published 2006-12-04 03:54 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
using NHibernate;
using RoomsHere.DataLayer;

namespace RoomsHere.JabaControls
{
    class JabaDropDownList : DropDownList 
    {
        public T GetSelectedEntity<T> () where T : class
        {
                if (this.SelectedValue == null) return null;

                long id = Convert.ToInt64(this.SelectedValue);
                ISession session = DL.SessionFactory.OpenSession();
                using (session)
                {
                    T entity = session.Load(typeof(T), id) as T;
                    return entity;
                }
            }
    }
}