Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Factories/AgendaFactory.cs @ 277:7439d7a5f8d0
Warning HTML: Cambiado ALT por TITLE.
author | juanjose.montesdeocaarbos |
---|---|
date | Tue, 20 Dec 2011 08:28:33 -0300 |
parents | bf993f99cee3 |
children |
line wrap: on
line source
using System; 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 IEventoRepository GetEventoRespository() { ISessionFactory sessionFactory = NhHelper.GetSessionFactory(); return new EventoRepository(sessionFactory); } public static PersonaService GetPersonaService() { return new PersonaService(GetPersonaRepository(), GetEventoRespository()); } public static IPatrocinadorRepository GetPatrocinadorRepository() { ISessionFactory sessionFactory = NhHelper.GetSessionFactory(); return new PatrocinadorRepository(sessionFactory); } } }