view Agendas/trunk/src/Agendas.Factories/AgendaFactory.cs @ 103:23325dddddcc

Persistencia del estado de los eventos
author jorge.rowies
date Sun, 05 Jun 2011 13:06:23 -0300
parents db4b1e2cae49
children a456eb519e23
line wrap: on
line source

using System;
using Agendas.NHibernate;
using AltNetHispano.Agendas.Domain;
using AltNetHispano.Agendas.Domain.Repositories;
using AltNetHispano.Agendas.Domain.Services;
using AltNetHispano.Agendas.Repositories.NHibernate;
using NHibernate;


namespace AltNetHispano.Agendas.Factories
{
	public static class AgendaFactory
	{
		private static Agenda _agenda;

		public static Agenda GetAgenda()
		{
			ISessionFactory sessionFactory = NhHelper.GetSessionFactory();
			return _agenda ?? (_agenda = new Agenda(null, new EventoRepository(sessionFactory), new PersonaRepository(sessionFactory)));
		}

		public static IPersonaRepository GetPersonaRepository()
		{
			ISessionFactory sessionFactory = NhHelper.GetSessionFactory();
			return new PersonaRepository(sessionFactory);
		}

		public static PersonaService GetPersonaService()
		{
			return new PersonaService(GetPersonaRepository());
		}
	}
}