コード例 #1
0
 public NakedObjectsFramework(IMessageBroker messageBroker,
                              ISession session,
                              ILifecycleManager lifecycleManager,
                              IServicesManager servicesManager,
                              INakedObjectManager nakedObjectManager,
                              IObjectPersistor persistor,
                              IReflector reflector,
                              IMetamodelManager metamodelManagerManager,
                              IContainerInjector containerInjector,
                              NakedObjectFactory nakedObjectFactory,
                              SpecFactory memberFactory,
                              ITransactionManager transactionManager,
                              IFrameworkResolver frameworkResolver)
 {
     this.messageBroker           = messageBroker;
     this.session                 = session;
     this.lifecycleManager        = lifecycleManager;
     this.servicesManager         = servicesManager;
     this.nakedObjectManager      = nakedObjectManager;
     this.persistor               = persistor;
     this.reflector               = reflector;
     this.metamodelManagerManager = metamodelManagerManager;
     this.containerInjector       = containerInjector;
     this.transactionManager      = transactionManager;
     this.frameworkResolver       = frameworkResolver;
     containerInjector.Framework  = this;
     memberFactory.Initialize(this);
     nakedObjectFactory.Initialize(metamodelManagerManager, session, lifecycleManager, persistor, nakedObjectManager);
 }
コード例 #2
0
        private void InstallFixture(ITransactionManager transactionManager, IContainerInjector injector, object fixture)
        {
            injector.InitDomainObject(fixture);

            // first, install any child fixtures (if this is a composite.
            var childFixtures = GetFixtures(fixture);

            InstallFixtures(transactionManager, injector, childFixtures);

            // now, install the fixture itself
            try {
                Log.Info("installing fixture: " + fixture);
                transactionManager.StartTransaction();
                InstallFixture(fixture);
                transactionManager.EndTransaction();
                Log.Info("fixture installed");
            }
            catch (Exception e) {
                Log.Error("installing fixture " + fixture.GetType().FullName + " failed (" + e.Message + "); aborting fixture ", e);
                try {
                    transactionManager.AbortTransaction();
                }
                catch (Exception e2) {
                    Log.Error("failure during abort", e2);
                }
                throw;
            }
        }
コード例 #3
0
 private void InstallFixtures(ITransactionManager transactionManager, IContainerInjector injector, object[] newFixtures)
 {
     foreach (var fixture in newFixtures)
     {
         InstallFixture(transactionManager, injector, fixture);
     }
 }
コード例 #4
0
        public LifeCycleManager(
            IMetamodelManager metamodel,
            IPersistAlgorithm persistAlgorithm,
            IOidGenerator oidGenerator,
            IContainerInjector injector,
            IObjectPersistor objectPersistor,
            INakedObjectManager nakedObjectManager
            )
        {
            Assert.AssertNotNull(metamodel);
            Assert.AssertNotNull(persistAlgorithm);
            Assert.AssertNotNull(oidGenerator);
            Assert.AssertNotNull(injector);
            Assert.AssertNotNull(objectPersistor);
            Assert.AssertNotNull(nakedObjectManager);

            this.metamodel          = metamodel;
            this.persistAlgorithm   = persistAlgorithm;
            this.oidGenerator       = oidGenerator;
            this.injector           = injector;
            this.objectPersistor    = objectPersistor;
            this.nakedObjectManager = nakedObjectManager;

            Log.DebugFormat("Creating {0}", this);
        }
コード例 #5
0
 /// <summary>
 ///   Constructs a DefaultKernel with the specified
 ///   implementation of <see cref = "IProxyFactory" /> and <see cref = "IDependencyResolver" />
 /// </summary>
 /// <param name = "resolver"></param>
 /// <param name = "proxyFactory"></param>
 public DefaultKernel(IDependencyResolver resolver, IProxyFactory proxyFactory)
 {
     RegisterSubSystems();
     //ReleasePolicy = new LifecycledComponentsReleasePolicy(this);
     //HandlerFactory = new DefaultHandlerFactory(this);
     ComponentModelBuilder = new DefaultComponentModelBuilder(this);
     //ProxyFactory = proxyFactory;
     //Resolver = resolver;
     //Resolver.Initialize(this, RaiseDependencyResolving);
     containerInjector = new SimpleIocInjector();
 }
コード例 #6
0
        public ServicesManager(IContainerInjector injector, INakedObjectManager manager, IReflectorConfiguration config)
        {
            Assert.AssertNotNull(injector);
            Assert.AssertNotNull(manager);
            Assert.AssertNotNull(config);

            this.injector = injector;
            this.manager  = manager;

            IEnumerable <ServiceWrapper> ms = config.MenuServices.Select(s => new ServiceWrapper(ServiceType.Menu, Activator.CreateInstance(s)));
            IEnumerable <ServiceWrapper> cs = config.ContributedActions.Select(s => new ServiceWrapper(ServiceType.Contributor, Activator.CreateInstance(s)));
            IEnumerable <ServiceWrapper> ss = config.SystemServices.Select(s => new ServiceWrapper(ServiceType.System, Activator.CreateInstance(s)));

            services = ms.Union(cs).Union(ss).Cast <IServiceWrapper>().ToList();
        }
コード例 #7
0
 public NakedObjectsDependencyResolver(IContainerInjector injector)
 {
     this.injector = injector;
 }