Table of Contents [Hide/Show]
Identifiable Services Already available services Future servicesNeeded changes for Windsor integration Cuyahoga.Core (CoreRepository) Cuyahoga.WebAdditionally usable components with Windsor NHiberate facility Event Wiring facility Logging facilityConclusion and estimated impact on existing codeCode samples IUserService ISiteService CuyahogaContainer CuyahogaHttpApplication
using System; using System.Collections;using Cuyahoga.Core.Domain;namespace Cuyahoga.Core.Service { public interface IUserService { User GetUserByUsernameAndPassword(string username, string password); User GetUserByUsernameAndEmail(string username, string email); IList FindUsersByUsername(string searchString); } }
using System; using System.Collections;using Cuyahoga.Core.Domain;namespace Cuyahoga.Core.Service { public interface ISiteService { //site Site GetSiteBySiteUrl(string siteUrl); SiteAlias GetSiteAliasByUrl(string url); IList GetSiteAliasesBySite(Site site); //node IList GetRootNodes(Site site); Node GetRootNodeByCultureAndSite(string culture, Site site); Node GetNodeByShortDescriptionAndSite(string shortDescription, Site site); IList GetNodesByTemplate(Template template); void UpdateNode(Node node, bool propagatePermissionsToChildNodes, bool propagatePermissionsToSections); void DeleteNode(Node node); void PropagatePermissionsToChildNodes(Node parentNode, bool propagateToSections); void PropagatePermissionsToSections(Node node); //menu IList GetMenusByRootNode(Node rootNode); //section IList GetSortedSectionsByNode(Node node); IList GetUnconnectedSections(); IList GetTemplatesBySection(Section section); //moduletype IList GetSectionsByModuleTypes(IList moduleTypes); } }
namespace Cuyahoga.Core { using System; using Castle.Windsor; using Castle.Windsor.Configuration.Interpreters; using Castle.MicroKernel; //using Castle.Facilities.AutomaticTransactionManagement; using Castle.Facilities.NHibernateIntegration; public class CuyahogaContainer : WindsorContainer { public CuyahogaContainer() : this( new XmlInterpreter("../app_config.xml") ) { } public CuyahogaContainer(XmlInterpreter interpreter) : base(interpreter) { Init(); } public void Init() { RegisterFacilities(); RegisterComponents(); //SubcribeForEvents(); } private void RegisterFacilities() { AddFacility( "nhibernate", new NHibernateFacility() ); //AddFacility( "transaction", new TransactionFacility() ); } protected void RegisterComponents() { AddComponent( "user.service", typeof(UserService) ); } protected void SubcribeForEvents() { } } }
public class CuyahogaHttpApplication : HttpApplication, IContainerAccessor { private static WindsorContainer container; public void Application_OnStart() { container = new CuyahogaContainer(); } public void Application_OnEnd() { container.Dispose(); } public IWindsorContainer Container { get { return container; } } }