Exemple #1
0
        private static void ConfigureStandardDependencies()
        {
            var assemblies = AppDomain
                             .CurrentDomain
                             .GetAssemblies()
                             .Where(a => a.GetReferencedAssemblies().Any(r => r.FullName.Contains("Mikado")) && !a.FullName.Contains("DynamicProxyGenAssembly2"))
                             .ToList();

            Assimilate.Dependencies(x => x.Scan(s =>
            {
                assemblies.ForEach(s.Assembly);
                s.ConnectImplementationsToTypesClosing(typeof(IRule <>));
            }));
            var rules =
                Assimilate
                .Assimilation
                .DependencyAdapter
                .RegisteredPluginTypes
                .Where(x => typeof(IRule).IsAssignableFrom(x) || x.IsAssignableFrom(typeof(IRule)))
                .Distinct();

            var simpleInterface = typeof(IRule);

            Assimilate.Dependencies(x => rules.ForEach(p => x.For(simpleInterface).Add(p)));
        }
        public void Initialize()
        {
            var handlerInterfaces    = GetHandlerInterfaces().ToList();
            var dispatcherPairs      = GetMessageDispatcherPairs(handlerInterfaces);
            var actorDispatcherPairs = GetActorDispatcherPairs(handlerInterfaces);
            var sagaPairs            = GetSagaDispatcherPairs();

            var simpleInterface = typeof(IDispatchMessage);

            Assimilate.Dependencies(x =>
            {
                dispatcherPairs
                .ForEach(p =>
                {
                    x.For(p.Item1).Use(p.Item2);
                    x.For(simpleInterface).Add(p.Item2);
                });

                actorDispatcherPairs
                .ForEach(p =>
                {
                    x.For(p.Item1).Use(p.Item2);
                    x.For(simpleInterface).Add(p.Item2);
                });

                sagaPairs
                .ForEach(p =>
                {
                    x.For(p.Item1).Use(p.Item2);
                    x.For(simpleInterface).Add(p.Item2);
                });
            });
        }
        public static IAssimilate Riak(this IAssimilate assimilate, Action <RiakConfigurator> configurate)
        {
            var configurator = new RiakConfigurator();

            configurate(configurator);
            Assimilate.Dependencies(x => x.For <IRiakConfiguration>().Use(configurator.Configuration));
            return(assimilate);
        }
        public DaemonConfigurator AsDynamicHost(Action <BootStrapConfigurator> bootstrapper)
        {
            var configurator = new BootStrapConfigurator();

            bootstrapper(configurator);
            Configuration.BootStrapConfiguration = configurator.Configuration;
            Assimilate.Dependencies(x => x.For <IBootStrapper>().Use <BootStrapper>().AsSingleton());
            return(this);
        }
Exemple #5
0
 public WcfClientConfigurator RegisterService <TContract, TStrategy>()
     where TStrategy : IServiceClientConfigurationStrategy <TContract>
     where TContract : class
 {
     Assimilate.Dependencies(x => x
                             .For <IServiceClientConfigurationStrategy <TContract> >()
                             .Use <TStrategy>());
     return(this);
 }
Exemple #6
0
 public WcfClientConfigurator RegisterService <TContract>(Action <IServiceConfiguration> configurationDelegate)
     where TContract : class
 {
     Assimilate.Dependencies(x => x
                             .For <IServiceClientConfigurationStrategy <TContract> >()
                             .CreateWith(
                                 context =>
                                 new DelegateConfigurationStrategy <TContract>(configurationDelegate)));
     return(this);
 }
        public static IAssimilate Lucene(this IAssimilate assimilate, Action <LuceneConfigurator> config)
        {
            var configurator = new LuceneConfigurator();

            config(configurator);
            var configuration = configurator.GetConfiguration();

            Assimilate.Dependencies(x => x.For <ILuceneConfiguration>().Use(configuration));

            return(assimilate);
        }
 public HttpServerConfigurator HostService <T>()
     where T : class
 {
     Assimilate.Dependencies(
         x => x.Scan(s =>
     {
         s.AssembliesFromApplicationBaseDirectory();
         s.TheCallingAssembly();
         s.AddAllTypesOf <T>();
     }));
     _configuration.RegisteredServices.Add(Tuple.Create(typeof(T), Assimilate.Assimilation.DependencyAdapter.GetDefaultTypeFor <T>()));
     return(this);
 }
        public void Initialize()
        {
            var rules =
                Assimilate
                .Assimilation
                .DependencyAdapter
                .RegisteredPluginTypes
                .Where(x => typeof(IRule).IsAssignableFrom(x) || x.IsAssignableFrom(typeof(IRule)))
                .Distinct();

            var simpleInterface = typeof(IRule);

            Assimilate.Dependencies(x => rules.ForEach(p => x.For(simpleInterface).Add(p)));
        }
Exemple #10
0
        public Action <DependencyConfigurator> Dependencies()
        {
            var config = new EideticConfigurator();

            Assimilate.Dependencies(x => x.For <IMemcachedClientConfiguration>()
                                    .Use(config.Configuration));

            return(container =>
            {
                container.For <IMemcachedClientConfiguration>()
                .Use <DefaultMemcachedConfiguration>();
                container.For <IRemembrance>()
                .Use <JsonRemembrance>();
                container.For <IRemember>()
                .Use <MemcachedAdapter>();
                container.For <ICacheProvider>()
                .Use <EideticCacheProvider>();
            });
        }
Exemple #11
0
        public static IAssimilate Messaging(this IAssimilate assimilate, Action <EventChannelConfigurator> eventChannels)
        {
            var publisher = Assimilate.GetInstanceOf <IEventPublisher>() as IObservable <IEvent>;

            if (publisher == null)
            {
                throw new AssimilationException(
                          "You must call the Actor assimilation extension method before setting up event channels in Symbiote.Messaging.");
            }

            var configurator = new EventChannelConfigurator();

            eventChannels(configurator);
            Assimilate.Dependencies(x => x.For <IEventChannelConfiguration>().Use(configurator.Configuration));

            EventSubscription = publisher.Subscribe(Assimilate.GetInstanceOf <EventChannel>());

            Preload();

            return(assimilate);
        }
Exemple #12
0
        public static void Configure(ICouchConfiguration configuration)
        {
            Assimilate.Dependencies(c =>
            {
                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."
                            );
                    }

                    c.For <IDocumentRepository>().Use <CachedDocumentRepository>();
                }
                else
                {
                    c.For <IDocumentRepository>().Use <DocumentRepository>();
                }
            });
        }
Exemple #13
0
        protected static void WireUpCommandMock(IHttpAction commandMock)
        {
            var mock = Assimilate.GetAllInstancesOf <IHttpAction>();

            Assimilate.Dependencies(x => x.For <IHttpAction>().Use(commandMock));
        }