/// <summary> /// Registers the modules type bindings /// </summary> /// <param name="builder"> /// The builder. /// </param> protected override void Load(ContainerBuilder builder) { // Logging #if DEBUG var logger = new TraceLogger(this.logCategoryName, this.logCategoryName, true); // Logger with debug output builder.RegisterInstance<ILogger>(logger); #else var logger = new TraceLogger(this.logCategoryName, this.logCategoryName, false); // Logger without debug output builder.RegisterInstance<ILogger>(logger); #endif // Binding var entitySchemaBuilder = new EntitySchemaBuilder<SharePointDataRowEntitySchema>(); var cachedBuilder = new CachedSchemaBuilder(entitySchemaBuilder, logger); builder.RegisterType<SharePointDataRowEntitySchema>(); builder.RegisterInstance<IEntitySchemaBuilder>(cachedBuilder); builder.RegisterType<TaxonomyValueDataRowConverter>(); builder.RegisterType<TaxonomyValueCollectionDataRowConverter>(); builder.RegisterType<TaxonomyValueConverter>(); builder.RegisterType<TaxonomyValueCollectionConverter>(); builder.RegisterType<SharePointEntityBinder>().As<ISharePointEntityBinder>().InstancePerSite(); // Singleton-per-site entity binder // Cache builder.RegisterType<CacheHelper>().As<ICacheHelper>(); // Definitions builder.RegisterType<ContentTypeBuilder>(); builder.RegisterType<FieldHelper>(); // Globalization + Variations (with default en-CA as source + fr-CA as destination implementation) builder.RegisterType<ResourceLocator>().As<IResourceLocator>(); // It's the container user's responsibility to register a IResourceLocatorConfig implementation builder.RegisterType<MuiHelper>(); builder.RegisterType<DateHelper>(); builder.RegisterType<RegionalSettingsHelper>(); builder.RegisterType<DefaultVariationDirector>().As<IVariationDirector>(); builder.RegisterType<CanadianEnglishAndFrenchVariationBuilder>().As<IVariationBuilder>(); builder.RegisterType<VariationExpert>().As<IVariationExpert>(); // Lists builder.RegisterType<ListHelper>(); builder.RegisterType<ListLocator>(); builder.RegisterType<ListSecurityHelper>(); // MasterPages builder.RegisterType<MasterPageHelper>(); builder.RegisterType<ExtraMasterPageBodyCssClasses>().As<IExtraMasterPageBodyCssClasses>(); // Repositories builder.RegisterType<FolderRepository>(); builder.RegisterType<QueryHelper>().As<IQueryHelper>(); // Security builder.RegisterType<SecurityHelper>(); builder.RegisterType<UserHelper>(); // Serializers builder.RegisterType<ServiceStackSerializer>().As<ISerializer>().SingleInstance(); // Setup builder.RegisterType<FieldValueInfo>().As<IFieldValueInfo>(); builder.RegisterType<FolderInfo>().As<IFolderInfo>(); builder.RegisterType<PageInfo>().As<IPageInfo>(); builder.RegisterType<TaxonomyInfo>().As<ITaxonomyInfo>(); builder.RegisterType<TaxonomyMultiInfo>().As<ITaxonomyMultiInfo>(); builder.RegisterType<FolderMaker>().As<IFolderMaker>(); builder.RegisterType<PageCreator>(); // Taxonomy builder.RegisterType<SiteTaxonomyCacheManager>().As<ISiteTaxonomyCacheManager>().SingleInstance(); builder.RegisterType<TaxonomyService>().As<ITaxonomyService>().InstancePerSite(); builder.RegisterType<TaxonomyHelper>(); // Timer Jobs builder.RegisterType<TimerJobExpert>().As<ITimerJobExpert>(); // Utils builder.RegisterType<EventReceiverHelper>(); builder.RegisterType<SearchHelper>(); builder.RegisterType<CustomActionHelper>(); builder.RegisterType<ContentOrganizerHelper>(); // Web config builder.RegisterType<WebConfigModificationHelper>(); // Web Parts builder.RegisterType<WebPartHelper>(); }
/// <summary> /// Registers the modules type bindings /// </summary> /// <param name="container">The container on which to register type bindings</param> public void Register(IUnityContainer container) { // Logging #if DEBUG var logger = new TraceLogger(this.logCategoryName, this.logCategoryName, true); // Logger with debug output container.RegisterInstance<ILogger>(logger); #else var logger = new TraceLogger(this.logCategoryName, this.logCategoryName, false); // Logger without debug output container.RegisterInstance<ILogger>(logger); #endif // Binding var builder = new EntitySchemaBuilder<SharePointEntitySchema>(); var cachedBuilder = new CachedSchemaBuilder(builder, logger); container.RegisterInstance<IEntitySchemaBuilder>(cachedBuilder); container.RegisterType<TaxonomyValueConverter>(); container.RegisterType<TaxonomyValueCollectionConverter>(); container.RegisterType<ISharePointEntityBinder, SharePointEntityBinder>(new ContainerControlledLifetimeManager()); // Singleton entity binder // Cache container.RegisterType<ICacheHelper, CacheHelper>(); // Definitions container.RegisterType<ContentTypeBuilder>(); container.RegisterType<FieldHelper>(); // Globalization + Variations (with default en-CA as source + fr-CA as destination implementation) container.RegisterInstance<IResourceLocator>(new ResourceLocator(this.defaultResourceFileNames)); container.RegisterType<MuiHelper>(); container.RegisterType<DateHelper>(); container.RegisterType<RegionalSettingsHelper>(); container.RegisterType<IVariationDirector, DefaultVariationDirector>(); container.RegisterType<IVariationBuilder, CanadianEnglishAndFrenchVariationBuilder>(); container.RegisterType<IVariationExpert, VariationExpert>(); // Lists container.RegisterType<ListHelper>(); container.RegisterType<ListSecurityHelper>(); // Master Pages container.RegisterType<MasterPageHelper>(); container.RegisterType<IExtraMasterPageBodyCssClasses, ExtraMasterPageBodyCssClasses>(); // Repositories container.RegisterType<FolderRepository>(); container.RegisterType<ListLocator>(); container.RegisterType<IQueryHelper, QueryHelper>(); // Security container.RegisterType<SecurityHelper>(); container.RegisterType<UserHelper>(); // Setup container.RegisterType<IFieldValueInfo, FieldValueInfo>(); container.RegisterType<IFolderInfo, FolderInfo>(); container.RegisterType<IPageInfo, PageInfo>(); container.RegisterType<ITaxonomyInfo, TaxonomyInfo>(); container.RegisterType<ITaxonomyMultiInfo, TaxonomyMultiInfo>(); container.RegisterType<IFolderMaker, FolderMaker>(); container.RegisterType<PageCreator>(); // Taxonomy container.RegisterType<ISiteTaxonomyCacheManager, SiteTaxonomyCacheManager>(); container.RegisterType<ITaxonomyService, TaxonomyService>(); container.RegisterType<TaxonomyService>(); container.RegisterType<TaxonomyHelper>(); // Timer Jobs container.RegisterType<ITimerJobExpert, TimerJobExpert>(); // Utilities container.RegisterType<EventReceiverHelper>(); container.RegisterType<SearchHelper>(); container.RegisterType<CustomActionHelper>(); container.RegisterType<ContentOrganizerHelper>(); // Web config container.RegisterType<WebConfigModificationHelper>(); // Web Parts container.RegisterType<WebPartHelper>(); }