Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Factories/AgendaFactory.cs @ 165:56f62516c172
Merge
author | nelopauselli |
---|---|
date | Fri, 05 Aug 2011 22:05:19 -0300 |
parents | 734d3f0853bf |
children | 5346c0500594 |
line wrap: on
line source
using Agendas.Blog.Impl; using Agendas.NHibernate; using AltNetHispano.Agendas.Domain; using AltNetHispano.Agendas.Domain.Repositories; using AltNetHispano.Agendas.Domain.Services; using AltNetHispano.Agendas.Google; 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() { var publicadores = new CompositePublicador(new IPublicador[] {new TwitterPublicador(), new BlogPublicador(), new GooglePublicador()}); ISessionFactory sessionFactory = NhHelper.GetSessionFactory(); return _agenda ?? (_agenda = new Agenda(publicadores, 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()); } } }