Example #1
0
    public void ReplaceEntityFactoryService(IEntityFactoryService newInstance)
    {
        var index     = MetaComponentsLookup.EntityFactoryService;
        var component = CreateComponent <EntityFactoryServiceComponent>(index);

        component.instance = newInstance;
        ReplaceComponent(index, component);
    }
Example #2
0
 public Services(IInputService inputService, ConfigService configService, IViewService unityViewService, IEntityFactoryService entityFactoryService, IAudioService audioService)
 {
     this.inputService         = inputService;
     this.configService        = configService;
     this.unityViewService     = unityViewService;
     this.entityFactoryService = entityFactoryService;
     this.audioService         = audioService;
 }
Example #3
0
 /// <summary>
 ///   Инициализирует хранилище зависимостями <see cref="IEntityFactoryService" />,
 ///   <see cref="IMessagingComponentFactory" />, <see cref="IIntegrationEventMapperFactory" />.
 /// </summary>
 /// <param name="entityFactoryService">Фабричный сервис для инфраструктурных операций с БД.</param>
 /// <param name="messagingComponentFactory">Фабрика компонентов для обмена сообщениями.</param>
 /// <param name="integrationEventMapperFactory">Фабрика подбора преобразователей событий.</param>
 public EventStore(
     IEntityFactoryService entityFactoryService, IMessagingComponentFactory messagingComponentFactory,
     IIntegrationEventMapperFactory integrationEventMapperFactory)
 {
     _entityFactoryService           = entityFactoryService.ThrowIfNull(nameof(entityFactoryService));
     _messagingComponentFactory      = messagingComponentFactory.ThrowIfNull(nameof(messagingComponentFactory));
     _integrationEventMapperStrategy = integrationEventMapperFactory.ThrowIfNull(nameof(integrationEventMapperFactory));
 }
Example #4
0
    public MetaEntity SetEntityFactoryService(IEntityFactoryService newInstance)
    {
        if (hasEntityFactoryService)
        {
            throw new Entitas.EntitasException("Could not set EntityFactoryService!\n" + this + " already has an entity with EntityFactoryServiceComponent!",
                                               "You should check if the context already has a entityFactoryServiceEntity before setting it or use context.ReplaceEntityFactoryService().");
        }
        var entity = CreateEntity();

        entity.AddEntityFactoryService(newInstance);
        return(entity);
    }
Example #5
0
    public void ReplaceEntityFactoryService(IEntityFactoryService newInstance)
    {
        var entity = entityFactoryServiceEntity;

        if (entity == null)
        {
            entity = SetEntityFactoryService(newInstance);
        }
        else
        {
            entity.ReplaceEntityFactoryService(newInstance);
        }
    }
Example #6
0
        public UnitOfWork(
            IEntityFactoryService factoryService, ISessionManager sessionManager, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted,
            bool autoControl = true, bool closeSessions = false)
        {
            _factoryService = factoryService.ThrowIfNull(nameof(factoryService));
            _sessionManager = sessionManager.ThrowIfNull(nameof(sessionManager));
            _isolationLevel = isolationLevel;
            _autoControl    = autoControl;
            _closeSessions  = closeSessions;

            if (!sessionManager.RegisterUoW(this))
            {
                throw new UowException("Unit of Work already exists");
            }

            _sessionManager.StartTransactionAll();
        }
Example #7
0
        public void SetupEntityFactory()
        {
            var container = new Container();

            container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();

            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("TestConfiguration/localDatabaseTests.json", optional: true)
                                .Build();

            container.RegisterInstance <IConfiguration>(configuration);

            container.RegisterInstance(new Mock <ISecurityContextFactory>().Object);

            container.RegisterPackages(new[]
            {
                typeof(MediatorPackage).Assembly,
                typeof(OrmPackage).Assembly,
                typeof(SQLiteOrmPackage).Assembly,
                typeof(TestPackage).Assembly,
            });

            _factory = container.GetInstance <IEntityFactoryService>();
        }
Example #8
0
 public GreetingsQueriesController(IEntityFactoryService efs)
 {
     _efs = efs.ThrowIfNull(nameof(efs));
 }
Example #9
0
 public CollisionDetectionSystem(Contexts contexts, IEntityFactoryService entityFactoryService) : base(contexts.game)
 {
     this.contexts             = contexts;
     this.entityFactoryService = entityFactoryService as EntityFactoryService;
 }