Dependency Injection: take the new 2013-specific registrations from the defunct GResgistrationModule and put them in the Autofac and Unity registration modules in their specific projects
Closed this issue · 1 comments
taoneill commented
Deleted GRegModule:
using GSoft.Dynamite.Binding;
using GSoft.Dynamite.Caching;
using GSoft.Dynamite.Logging;
using GSoft.Dynamite.Navigation;
using GSoft.Dynamite.Repositories;
using GSoft.Dynamite.Taxonomy;
using GSoft.Dynamite.Utils;
using Microsoft.Practices.Unity;
namespace GSoft.Dynamite.Unity
{
/// <summary>
/// Container registrations for GSoft.G.SharePoint components
/// </summary>
public class GRegistrationModule : IRegistrationModule
{
private readonly string _logCategoryName;
private readonly string _defaultResourceFileName;
/// <summary>
/// Creates a new registration module to prepare dependency injection
/// for GSoft.G.SharePoint components
/// </summary>
/// <param name="logCategoryName">The ULS category in use when interacting with ILogger</param>
/// <param name="defaultResourceFileName">The default resource file name when interacting with IResourceLocator</param>
public GRegistrationModule(string logCategoryName, string defaultResourceFileName)
{
this._logCategoryName = logCategoryName;
this._defaultResourceFileName = defaultResourceFileName;
}
/// <summary>
/// Registers the modules type bindings
/// </summary>
/// <param name="container">The container on which to register type bindings</param>
public void Register(IUnityContainer container)
{
#if DEBUG
// Logger with debug output
var logger = new TraceLogger(this._logCategoryName, this._logCategoryName, true);
container.RegisterInstance<ILogger>(logger);
#else
// Logger without debug output
var logger = new TraceLogger(this._logCategoryName, this._logCategoryName, false);
container.RegisterInstance<ILogger>(logger);
#endif
// Binding
var builder = new EntitySchemaBuilder<SharePointEntitySchema>();
var binder = new SharePointEntityBinder(new CachedSchemaBuilder(builder, logger));
container.RegisterInstance<ISharePointEntityBinder>(binder);
// Taxonomy
container.RegisterType<ITaxonomyService, TaxonomyService>();
container.RegisterType<TaxonomyService>();
container.RegisterType<TaxonomyHelper>();
// Navigation
container.RegisterType<ICatalogNavigation, CatalogNavigation>();
// Caching
container.RegisterType<IAppCacheHelper, AppCacheHelper>();
container.RegisterType<ISessionCacheHelper, SessionCacheHelper>();
// Repositories
container.RegisterType<FolderRepository>();
container.RegisterType<ListLocator>();
// Utilities
container.RegisterInstance<IResourceLocator>(new ResourceLocator(this._defaultResourceFileName));
container.RegisterType<ContentTypeHelper>();
container.RegisterType<EventReceiverHelper>();
container.RegisterType<FieldHelper>();
container.RegisterType<ListHelper>();
container.RegisterType<ListSecurityHelper>();
container.RegisterType<MuiHelper>();
container.RegisterType<SecurityHelper>();
container.RegisterType<SearchHelper>();
container.RegisterType<WebPartHelper>();
container.RegisterType<MasterPageHelper>();
container.RegisterType<RegionalSettingsHelper>();
container.RegisterType<CustomActionHelper>();
container.RegisterType<WebConfigModificationHelper>();
container.RegisterType<VariationsHelper>();
container.RegisterType<NavigationHelper>();
}
}
}