void Common.IContainer.RegisterSingleton(Type lookupType, object instance)
 {
     container.Configure(x => x.For(lookupType)
                         .Singleton()
                         .Use(instance));
     PluginCache.AddFilledType(lookupType);
 }
        public void SetFilledTypes_3()
        {
            PluginCache.ResetAll();
            PluginCache.AddFilledType(typeof(IGateway));

            Plugin plugin = PluginCache.GetPlugin(typeof(ClassWithProperties));

            plugin.Setters.IsMandatory("Engine").ShouldBeFalse();
            plugin.Setters.IsMandatory("Car").ShouldBeFalse();
            plugin.Setters.IsMandatory("Gateway").ShouldBeTrue();
        }
Ejemplo n.º 3
0
        public RavenRegistry()
        {
            var store = new DocumentStore
            {
                ConnectionStringName = "RavenDB"
            };

            store.Initialize();

            ObjectFactory.Configure(c =>
            {
                c.ForSingletonOf <IDocumentStore>()
                .Use(store);
                c.ForSingletonOf <DocumentStore>()
                .Use(store);
                c.For <IDocumentSession>()
                .HybridHttpOrThreadLocalScoped()
                .Use(OpenSession);

                PluginCache.AddFilledType(typeof(IDocumentSession));
            });
        }
Ejemplo n.º 4
0
        public RavenRegistry()
        {
            var store = new DocumentStore
            {
                ConnectionStringName = "RavenDB"
            };

            store.Initialize();

            ObjectFactory.Configure(c =>
            {
                c.ForSingletonOf <IDocumentStore>()
                .Use(store);
                c.For <IDocumentSession>()
                .Use(OpenSession);

                PluginCache.AddFilledType(typeof(IDocumentSession));

                c.For <IManageUnitsOfWork>()
                .Use <RavenUnitOfWork>();
            });
        }
Ejemplo n.º 5
0
        public void Init()
        {
            var store = new DocumentStore {
                Url = "http://localhost:8082", DefaultDatabase = "MyDatabase"
            };

            store.Initialize();

            ObjectFactory.Configure(c =>
            {
                c.For <IDocumentStore>()
                .Singleton()
                .Use(store);

                c.For <IDocumentSession>()
                .Use(ctx => ctx.GetInstance <IDocumentStore>()
                     .OpenSession());

                PluginCache.AddFilledType(typeof(IDocumentSession));

                c.For <IManageUnitsOfWork>()
                .Use <MyRavenUnitOfWork>();
            });
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Directs StructureMap to always inject dependencies into any and all public Setter properties
 /// of the type PLUGINTYPE.
 /// </summary>
 /// <typeparam name="PLUGINTYPE"></typeparam>
 /// <returns></returns>
 public CreatePluginFamilyExpression <PLUGINTYPE> FillAllPropertiesOfType <PLUGINTYPE>()
 {
     PluginCache.AddFilledType(typeof(PLUGINTYPE));
     return(ForRequestedType <PLUGINTYPE>());
 }
 void Common.IContainer.RegisterSingleton(Type lookupType, object instance)
 {
     container.Inject(lookupType, instance);
     PluginCache.AddFilledType(lookupType);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Tells StructureMap to do setter injection for the given type
 /// </summary>
 public static void EnableSetterInjectionFor(this ConfigurationExpression configuration, Type pluginType)
 {
     PluginCache.AddFilledType(pluginType);
 }