예제 #1
0
        public static EntityObjectStoreConfiguration EntityObjectStoreConfig()
        {
            var config = new EntityObjectStoreConfiguration();

            config.UsingCodeFirstContext(() => new ExampleDbContext("NakedObjectsTemplate", new ExampleDbInitializer()));
            return(config);
        }
        protected virtual void RegisterTypes(IUnityContainer container)
        {
            //Standard configuration
            StandardUnityConfig.RegisterStandardFacetFactories(container);
            StandardUnityConfig.RegisterCoreContainerControlledTypes(container);
            StandardUnityConfig.RegisterCorePerTransactionTypes <PerResolveLifetimeManager>(container);

            container.RegisterType <IPrincipal>(new InjectionFactory(c => TestPrincipal));
            var config = new EntityObjectStoreConfiguration();

            //config.UsingEdmxContext("Model").AssociateTypes(AdventureWorksTypes);
            //config.SpecifyTypesNotAssociatedWithAnyContext(() => new[] { typeof(AWDomainObject) });

            container.RegisterInstance <IEntityObjectStoreConfiguration>(config, (new ContainerControlledLifetimeManager()));

            // TODO still done for backward compatibility -
            var reflectorConfig = new ReflectorConfiguration(
                Types ?? new Type[] {},
                MenuServices.Select(s => s.GetType()).ToArray(),
                ContributedActions.Select(s => s.GetType()).ToArray(),
                SystemServices.Select(s => s.GetType()).ToArray(),
                Namespaces ?? new string[] { });

            container.RegisterInstance <IReflectorConfiguration>(reflectorConfig, (new ContainerControlledLifetimeManager()));
            container.RegisterType <ISession>(new PerResolveLifetimeManager(), new InjectionFactory(c => TestSession));
        }
예제 #3
0
        public static EntityObjectStoreConfiguration EntityObjectStoreConfig(IConfiguration configuration)
        {
            var config = new EntityObjectStoreConfiguration();

            config.UsingContext(() => AppConfig.CreateDbContext());
            return(config);
        }
        public static EntityObjectStoreConfiguration EntityObjectStoreConfig()
        {
            var config = new EntityObjectStoreConfiguration();

            config.UsingCodeFirstContext(() => new AdventureWorksContext());
            return(config);
        }
예제 #5
0
        public static EntityObjectStoreConfiguration EntityObjectStoreConfig()
        {
            var config = new EntityObjectStoreConfiguration();

            config.UsingCodeFirstContext(() => new CodeFirstContext("RestTest"));
            return(config);
        }
        public static EntityObjectStoreConfiguration EntityObjectStoreConfig()
        {
            var config = new EntityObjectStoreConfiguration();

            config.UsingEdmxContext("Model").AssociateTypes(AssociatedTypes);
            config.SpecifyTypesNotAssociatedWithAnyContext(() => new[] { typeof(AWDomainObject) });
            return(config);
        }
        public static EntityObjectStoreConfiguration EntityObjectStoreConfig(IConfiguration configuration)
        {
            var config = new EntityObjectStoreConfiguration();
            var cs     = configuration.GetConnectionString("AdventureWorksContext");

            config.UsingContext(() => new AdventureWorksContext(cs));
            return(config);
        }
예제 #8
0
        public static EntityObjectStoreConfiguration EntityObjectStoreConfig()
        {
            var config = new EntityObjectStoreConfiguration();

            config.UsingCodeFirstContext(() => new AdventureWorksContext());
            config.SpecifyTypesNotAssociatedWithAnyContext(() => new[] { typeof(PropertyViewModel), typeof(FindViewModel) });
            return(config);
        }
예제 #9
0
        public static EntityObjectStoreConfiguration EntityObjectStoreConfig(IConfiguration configuration)
        {
            var config = new EntityObjectStoreConfiguration();
            var cs     = configuration.GetConnectionString("ExampleConnectionString");

            config.UsingContext(() => new ExampleDbContext(cs, new ExampleDbInitializer()));
            return(config);
        }
예제 #10
0
        protected override void RegisterTypes(IUnityContainer container)
        {
            base.RegisterTypes(container);
            var config = new EntityObjectStoreConfiguration {
                EnforceProxies = false
            };

            config.UsingEdmxContext("Model");
            container.RegisterInstance <IEntityObjectStoreConfiguration>(config, (new ContainerControlledLifetimeManager()));
        }
        public static EntityObjectStoreConfiguration EntityObjectStoreConfig(IConfiguration configuration)
        {
            var config = new EntityObjectStoreConfiguration();
            var cs     = configuration.GetConnectionString("RestTest");

            DbContext GetContext() => cs.Contains("SQLEXPRESS") ? (DbContext) new CodeFirstContextLocal(cs) : new CodeFirstContext(cs);

            config.UsingContext(GetContext);
            return(config);
        }
        protected override void RegisterTypes(IUnityContainer container)
        {
            base.RegisterTypes(container);
            var config = new EntityObjectStoreConfiguration {
                EnforceProxies = false
            };

            config.UsingCodeFirstContext(() => Activator.CreateInstance <TContext>());
            container.RegisterInstance(config, (new ContainerControlledLifetimeManager()));
        }
        protected override void RegisterTypes(IUnityContainer container)
        {
            base.RegisterTypes(container);
            var config = new EntityObjectStoreConfiguration {
                EnforceProxies = false
            };

            config.UsingCodeFirstContext(() => new MvcTestContext("SystemHelperTest"));
            container.RegisterInstance <IEntityObjectStoreConfiguration>(config, (new ContainerControlledLifetimeManager()));
        }
        protected override void RegisterTypes(IUnityContainer container)
        {
            base.RegisterTypes(container);
            var config = new EntityObjectStoreConfiguration {
                EnforceProxies = false
            };

            config.UsingCodeFirstContext(() => new PolymorphicNavigationContext(databaseName));
            container.RegisterInstance <IEntityObjectStoreConfiguration>(config, (new ContainerControlledLifetimeManager()));
            container.RegisterType <IMenuFactory, ReflectorTest.NullMenuFactory>();
        }
        protected override void RegisterTypes(IUnityContainer container)
        {
            base.RegisterTypes(container);
            var config = new EntityObjectStoreConfiguration {
                EnforceProxies = false
            };

            config.UsingCodeFirstContext(() => new AdventureWorksContext());
            container.RegisterInstance <IEntityObjectStoreConfiguration>(config, (new ContainerControlledLifetimeManager()));

            container.RegisterType <IFrameworkFacade, FrameworkFacade>(new PerResolveLifetimeManager());
            container.RegisterType <IOidStrategy, EntityOidStrategy>(new PerResolveLifetimeManager());
            container.RegisterType <IOidTranslator, OidTranslatorSemiColonSeparatedList>(new PerResolveLifetimeManager());
        }
        protected override void RegisterTypes(IUnityContainer container)
        {
            base.RegisterTypes(container);
            // replace INakedObjectStore types
            var c = new EntityObjectStoreConfiguration();

            c.UsingCodeFirstContext(() => new TestContext("TestContext"));
            container.RegisterInstance <IEntityObjectStoreConfiguration>(c, new ContainerControlledLifetimeManager());

            var types = new[] { typeof(TestDomainObject[]), typeof(List <TestDomainObject>), typeof(ObjectQuery <TestDomainObject>), typeof(List <Int32>) };
            var ms    = new[] { typeof(SimpleRepository <TestDomainObject>) };
            var ns    = new[] { typeof(TestDomainObject).Namespace };
            var rc    = new ReflectorConfiguration(types, ms, ns);

            container.RegisterInstance <IReflectorConfiguration>(rc, new ContainerControlledLifetimeManager());
        }
예제 #17
0
        private static EntityObjectStoreConfiguration EntityObjectStoreConfiguration(IConfiguration configuration, EntityPersistorOptions options)
        {
            var config = new EntityObjectStoreConfiguration {
                EnforceProxies      = options.EnforceProxies,
                CustomConfig        = options.CustomConfig,
                DefaultMergeOption  = options.DefaultMergeOption,
                MaximumCommitCycles = options.MaximumCommitCycles,
                NotPersistedTypes   = options.NotPersistedTypes,
                RollBackOnError     = options.RollBackOnError,
                RequireExplicitAssociationOfTypes = options.RequireExplicitAssociationOfTypes
            };

            var contexts = options.ContextInstallers.Select <Func <IConfiguration, DbContext>, Func <DbContext> >(f => () => f(configuration));

            contexts.ForEach(c => config.UsingContext(c));
            return(config);
        }
 public static EntityObjectStoreConfiguration EntityObjectStoreConfig()
 {
     var config = new EntityObjectStoreConfiguration();
     config.UsingCodeFirstContext(() => new ExampleDbContext("NakedObjectsExample"));
     return config;
 }