public static void Configure( Action<CouchConfigurator> configure ) { Assimilate.Initialize(); var config = new CouchConfigurator(); configure( config ); Configure( config.Configuration ); }
public Action<DependencyConfigurator> DefineDependencies() { var configurator = new CouchConfigurator(); var configuration = configurator.Configuration; return container => { container.For<ICouchConfiguration>().Use( configuration ); container.For<IHttpAction>().Use<HttpAction>(); container.For<ICouchCacheProvider>().Use<CouchCacheProvider>(); container.For<ICacheKeyBuilder>().Use<CacheKeyBuilder>(); container.For<ICouchServer>().Use<CouchDbServer>(); container.For<ISerializationProvider>().Use<SerializationProvider>().AsSingleton(); container.For<IProvideDocumentMetadata>().Use<DocumentMetadataProvider>().AsSingleton(); container.For<IValueProviderCache>().Use<MetadataValueProviderCache>(); container.For<IKeyAssociationManager>().Use<DefaultKeyAssociationManager>(). AsSingleton(); if ( configuration.Cache ) { if (!Assimilate.Assimilation.DependencyAdapter.HasPluginFor<ICacheProvider>() ) { throw new CouchConfigurationException( "You must have an implementation of ICacheProvider configured to use caching in Couch. Consider referencing Symbiote.Eidetic and adding the .Eidetic() call before this in your assimilation to utilize memcached or memcachedb as the cache provider for Couch." ); } container.For<IDocumentRepository>().Use<CachedDocumentRepository>(); } else { container.For<IDocumentRepository>().Use<DocumentRepository>(); } }; }
public static IAssimilate Relax(this IAssimilate assimilate, Action<CouchConfigurator> configure) { var config = new CouchConfigurator(); configure(config); assimilate .Dependencies(c => { var configuration = config.GetConfiguration(); c.For<ICouchConfiguration>().Use(configuration); c.For<ICouchCommand>().Use<CouchCommand>(); c.For<ICouchCommandFactory>().Use<CouchCommandFactory>(); c.For<ICouchCacheProvider>().Use<EideticCacheProvider>(); c.For<ICacheKeyBuilder>().Use<CacheKeyBuilder>(); c.For<ICouchServer>().Use<CouchDbServer>(); if (configuration.Cache) { if(!ObjectFactory.Container.Model.HasDefaultImplementationFor<IRemember>()) { throw new AssimilationException( "You must have an implementation of IRemember configured to use caching in Relax. Consider referencing Symbiote.Eidetic and adding the .Eidetic() call before this in your assimilation to utilize memcached or memcachedb as the cache provider for Relax." ); } c.For<IDocumentRepository>().Use<CachedDocumentRepository>(); } else { c.For<IDocumentRepository>().Use<DocumentRepository>(); } }); return assimilate; }
public static IAssimilate Couch( this IAssimilate assimilate, Action<CouchConfigurator> configure ) { var config = new CouchConfigurator(); configure( config ); var configuration = config.Configuration; CouchInit.Configure( configuration ); return assimilate; }
public static void Configure(Action <CouchConfigurator> configure) { Assimilate.Initialize(); var config = new CouchConfigurator(); configure(config); Configure(config.Configuration); }
public static IAssimilate Couch(this IAssimilate assimilate, Action <CouchConfigurator> configure) { var config = new CouchConfigurator(); configure(config); var configuration = config.Configuration; CouchInit.Configure(configuration); return(assimilate); }