view Agendas/trunk/src/Agendas.Factories/AgendaFactory.cs @ 138:62791999ad01

Agregando relación entre Evento y Patrocinador
author nelopauselli
date Thu, 28 Jul 2011 10:13:28 -0300
parents a456eb519e23
children 734d3f0853bf
line wrap: on
line source

using Agendas.NHibernate;
using AltNetHispano.Agendas.Domain;
using AltNetHispano.Agendas.Domain.Repositories;
using AltNetHispano.Agendas.Domain.Services;
using AltNetHispano.Agendas.Repositories.NHibernate;
using AltNetHispano.Agendas.Twitter;
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(new TwitterPublicador(), new EventoRepository(sessionFactory),
			                   new PersonaRepository(sessionFactory), new PatrocinadorRepository(sessionFactory)));
		}

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

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