view Agendas/trunk/src/Agendas.Factories/AgendaFactory.cs @ 117:7ef7e4bb71f6

manejo de mensajes al usuario
author Nelo@Kenia.neluz.int
date Sun, 19 Jun 2011 13:35:34 -0300
parents a456eb519e23
children 1e47bf408073 62791999ad01
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)));
		}

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

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