All pastes #266452 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-12-04 03:46 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.AssJabbingControls
{
    class AssJabbingDropDownList : DropDownList
    {

        public T SelectedEntity<T>
        {
            get
            {
                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;
                }
            }
          }
    }
}