diff Agendas/trunk/src/Agendas.NHibernate/EventoStateType.cs @ 140:3639803112c6

Refactoring de la relación entre Evento y Estado
author nelopauselli
date Fri, 29 Jul 2011 16:30:53 -0300
parents
children 68b09c30b0d2
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.NHibernate/EventoStateType.cs	Fri Jul 29 16:30:53 2011 -0300
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using AltNetHispano.Agendas.Domain;
+using NHibernate.SqlTypes;
+
+namespace Agendas.NHibernate
+{
+	public class EventoStateType : GenericWellKnownInstanceType<EventoState, string> 
+	{
+		public static IEnumerable<EventoState> All
+		{
+			get
+			{
+				return new[]
+			       	{
+			       		EventoNullState.GetInstance(), EventoPropuestoState.GetInstance(), EventoAgendadoState.GetInstance(),
+			       		EventoConfirmadoState.GetInstance(), EventoPublicadoState.GetInstance(), EventoCanceladoState.GetInstance(),
+			       		EventoDescartadoState.GetInstance()
+			       	};
+			}
+		}
+
+		public EventoStateType()
+			: base(All, (state, id) => state.Descripcion == id, state => state.Descripcion)
+		{
+		}
+
+		public override SqlType[] SqlTypes
+		{
+			get { return new[] {SqlTypeFactory.GetString(25)}; }
+		}
+	}
+}
\ No newline at end of file