Пример #1
0
 protected BasePageElementProcessor(IResourceFactory factory, IRelativePathProducer relativePathProducer, IResourcesStack resourcesStack, Uri initialhostUri)
 {
     Factory = factory;
     ResourcesStack = resourcesStack;
     RelativePathProducer = relativePathProducer;
     InitialDomain = initialhostUri;
 }
 protected UnprocessableElementProcessor(IResourceFactory factory, 
     IRelativePathProducer relativePathProducer, 
     IResourcesStack resourcesStack, 
     Uri initialHostUri)
     : base(factory, relativePathProducer, resourcesStack, initialHostUri)
 {
 }
        public Engine(IUserInterface userInterface,IDatabase db)
        {
            this.buildingFactory = new BuildingFactory();
            this.resourceFactory = new ResourceFactory();
            this.unitFactory = new UnitFactory();

            this.io = userInterface;
            this.db = db;
        }
Пример #4
0
 public Engine(IUnitFactory unitFactory, IResourceFactory resourceFactory,IBuildingFactory buildingFactory, IInputReader reader, IOutputWriter writer, IEmpiresData data)
 {
     this.unitFactory = unitFactory;
     this.resourceFactory = resourceFactory;
     this.buildingFactory = buildingFactory;
     this.reader = reader;
     this.writer = writer;
     this.data = data;
 }
Пример #5
0
 public Engine(IBuildingFactory buildingFactory, IResourceFactory resourceFactory, IUnitFactory unitFactory, IData data, IInputReader reader, IOuptupWriter writer)
 {
     this.buildingFactory = buildingFactory;
     this.resourceFactory = resourceFactory;
     this.unitFactory = unitFactory;
     this.data = data;
     this.reader = reader;
     this.writer = writer;
 }
 protected Building(string unitType, int unitCycleLength, ResourceType resourceType, int resourceCycleLength, int resourceQuantity, IUnitFactory unitFactory, IResourceFactory resourceFactory)
 {
     this.unitType = unitType;
     this.unitCycleLength = unitCycleLength;
     this.resourceType = resourceType;
     this.resourceCycleLength = resourceCycleLength;
     this.resourceQuantity = resourceQuantity;
     this.unitFactory = unitFactory;
     this.resourceFactory = resourceFactory;
 }
Пример #7
0
 public Archery(IUnitFactory unitFactory, IResourceFactory resourceFactory)
     : base(UnitType,
          UnitCicleLenth,
          ArcheryResourceType,
          ResourceCicleLength,
          ResourceQuantity,
          unitFactory,
          resourceFactory)
 {
 }
Пример #8
0
 public Archery( IUnitFactory unitFactory, IResourceFactory resourseFactory)
     : base(ArcheryUnitType,
            ArcheryUnitCycleLength,
            ArcheryResourseType,
            ArcheryResourceCycleLength,
            unitFactory,
            ArcheryResourceQuantity,
            resourseFactory)
 {
 }
Пример #9
0
 public Barracks(IUnitFactory unitFactory, IResourceFactory resourceFactory)
     : base(UnitType,
          UnitCicleLenth,
          BarracsResourceType,
          ResourceCicleLength,
          ResourceQuantity,
          unitFactory,
          resourceFactory)
 {
 }
        public IBuilding CreateBuilding(string buildingType, IResourceFactory resourceFactory, IUnitFactory unitFactory)
        {
            var type = Assembly.GetExecutingAssembly()
                .GetTypes()
                .FirstOrDefault(t => t.Name.ToLowerInvariant() == buildingType);

            var building = (IBuilding)Activator.CreateInstance(type, unitFactory, resourceFactory);

            return building;
        }
Пример #11
0
 public Barracks(IUnitFactory unitFactory, IResourceFactory resourceFactory)
     : base(BarracksUnitType,
           BarracksUnitCycleLength,
           BarracksResourceType,
           BarracksResourceCycleLength,
           BarracksResourceQuantity,
           unitFactory, 
           resourceFactory)
 {
 }
        public WriteCacheFilter(ICacheResolver cacheResolver, IResourceFactory resourceFactory)
            : base(cacheResolver)
        {
            if (resourceFactory == null)
            {
                throw new ArgumentNullException(nameof(resourceFactory));
            }

            this.resourceFactory = resourceFactory;
            this.typeLookup = new ResourceTypeLookup();
        }
		public void Init()
		{
			resourceFactoryMock = mockRepository.DynamicMock<IResourceFactory>();

			StubRequest request = new StubRequest();
			StubResponse response = new StubResponse();
			services = new StubMonoRailServices();
			engStubViewEngineManager = new StubViewEngineManager();
			services.ViewEngineManager = engStubViewEngineManager;
			services.ResourceFactory = resourceFactoryMock;
			engineContext = new StubEngineContext(request, response, services, null);
		}
Пример #14
0
 public IBuilding CreateBuilding(string buildingType, IUnitFactory unitFactory, IResourceFactory resourceFactory)
 {
     switch (buildingType)
     {
         case "archery":
             return new Archery(unitFactory, resourceFactory);
         case "barracks":
             return new Barracks(unitFactory, resourceFactory);
         default:
             throw new ArgumentException("Unknow building type.");
     }
 }
        public IBuilding CreateBuilding(string buildingType, IUnitFactory unitFactory, IResourceFactory resourceFactory)
        {
            // Reflection
            var type = Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(t => t.Name.ToLowerInvariant() == buildingType);
            if (type == null)
            {
                throw new AggregateException("Unknow building type");
            }
            var building = (IBuilding)Activator.CreateInstance(type, unitFactory, resourceFactory);

            return building;
        }
		private string LoadAndPlay(IResourceFactory factory, PlayData data)
		{
			if (data.Resource == null)
			{
				string netlinkurl = TextUtil.ExtractUrlFromBB(data.Message);

				AudioResource resource;
				RResultCode result = factory.GetResource(netlinkurl, out resource);
				if (result != RResultCode.Success)
					return $"Could not play ({result})";
				data.Resource = resource;
			}
			return PostProcessStart(factory, data);
		}
        public IBuilding CreateBuilding(string buildingType, IUnitFactory unitFactory, IResourceFactory resourceFacotory)
        {
            var type = Assembly.GetExecutingAssembly().GetTypes()
                .FirstOrDefault(t => t.Name.ToLowerInvariant() == buildingType);

            if (type == null)
            {
                throw new InvalidOperationException("Invalid building type.");
            }

            var building = Activator.CreateInstance(type, unitFactory, resourceFacotory) as IBuilding;

            return building;
        }
        public IBuilding CreateBuilding(string buildingType,IResourceFactory rf, IUnitFactory bf)
        {
            var type = Assembly.GetExecutingAssembly().GetTypes()
               .FirstOrDefault(t => t.Name.ToLowerInvariant() == buildingType);

            if (type == null)
            {
                throw new ArgumentException("Unknown building type.");
            }

            var building = (IBuilding)Activator.CreateInstance(type, rf, bf);

            return building;
        }
Пример #19
0
 public Engine(
     IBuildingFactory buildingFactory,
     IResourceFactory resourceFactory,
     IUnitFactory unitFactory,
     IDatabase db,
     IInputReader reader,
     IOutputWriter writer)
 {
     this.buildingFactory = buildingFactory;
     this.resourceFactory = resourceFactory;
     this.unitFactory = unitFactory;
     this.db = db;
     this.reader = reader;
     this.writer = writer;
 }
Пример #20
0
 /// <summary>
 /// Gets the message queue transaction from thread local storage
 /// </summary>
 /// <param name="resourceFactory">The resource factory.</param>
 /// <returns>null if not found in thread local storage</returns>
 public static MessageQueueTransaction GetMessageQueueTransaction(IResourceFactory resourceFactory)
 {
     MessageQueueResourceHolder resourceHolder =
         (MessageQueueResourceHolder)
         TransactionSynchronizationManager.GetResource(
             MessageQueueTransactionManager.CURRENT_TRANSACTION_SLOTNAME);
     if (resourceHolder != null)
     {
         return resourceHolder.MessageQueueTransaction;
     }
     else
     {
         return null;
     }                
 }
Пример #21
0
 protected Building(ResourceType resourceType,
     int resourceProduceTime,
     int resourceQuantity,
     string unitType,
     int unitProduceTime,
     IUnitFactory unitFactory,
     IResourceFactory resourceFactory)
 {
     this.resourceType = resourceType;
     this.resourceProduceTime = resourceProduceTime;
     this.Quantity = resourceQuantity;
     this.unitType = unitType;
     this.unitProduceTime = unitProduceTime;
     this.unitFactory = unitFactory;
     this.resourceFactory = resourceFactory;
 }
Пример #22
0
 public Building(
     string unitType,
     int unitCicleLength,
     ResourceType resourceType,
     int resourceCicleLength,
     int quantity,
     IUnitFactory unitFactory,
     IResourceFactory resourceFactory)
 {
     this.unitType = unitType;
     this.unitCicleLength = unitCicleLength;
     this.resourceType = resourceType;
     this.resourceCicleLength = resourceCicleLength;
     this.quantity = quantity;
     this.unitFactory = unitFactory;
     this.resourceFactory = resourceFactory;
 }
Пример #23
0
 IHttpHostConfigurationBuilder IHttpHostConfigurationBuilder.SetResourceFactory(IResourceFactory factory)
 {
     this.InstanceFactory = factory;
     return(this);
 }
Пример #24
0
 public ATagLinksProcessor(IResourceFactory factory, IRelativePathProducer relativePathProducer, IResourcesStack resourcesStack, int deep, Uri initialHostUri, bool loadOtherOrigins) 
     : base(factory, relativePathProducer, resourcesStack, initialHostUri)
 {
     _loadOtherOrigins = loadOtherOrigins;
     Deep = deep;
 }
 public Barrack(IResourceFactory resourceFactory, IUnitFactory unitFactory) 
     : base(resourceFactory, unitFactory)
 {
     
 }
Пример #26
0
 public TestResourceRepository(ITargetedFields targetedFields, IDbContextResolver contextResolver, IResourceGraph resourceGraph,
                               IResourceFactory resourceFactory, IEnumerable <IQueryConstraintProvider> constraintProviders, ILoggerFactory loggerFactory)
     : base(targetedFields, contextResolver, resourceGraph, resourceFactory, constraintProviders, loggerFactory)
 {
 }
Пример #27
0
 public TestDeserializer(IResourceGraph resourceGraph, IResourceFactory resourceFactory) : base(resourceGraph, resourceFactory)
 {
 }
Пример #28
0
 public FilterQueryStringParameterReader(IJsonApiRequest request,
                                         IResourceContextProvider resourceContextProvider, IResourceFactory resourceFactory, IJsonApiOptions options)
     : base(request, resourceContextProvider)
 {
     _options      = options ?? throw new ArgumentNullException(nameof(options));
     _scopeParser  = new QueryStringParameterScopeParser(resourceContextProvider, FieldChainRequirements.EndsInToMany);
     _filterParser = new FilterParser(resourceContextProvider, resourceFactory, ValidateSingleField);
 }
Пример #29
0
 public ResourceHookExecutorFacade(IResourceHookExecutor resourceHookExecutor, IResourceFactory resourceFactory)
 {
     _resourceHookExecutor =
         resourceHookExecutor ?? throw new ArgumentNullException(nameof(resourceHookExecutor));
     _resourceFactory = resourceFactory ?? throw new ArgumentNullException(nameof(resourceFactory));
 }
        private ElasticResourcePool(int minIdle, IResourceFactory <TResource, TArguments> factory) : base(factory)
        {
            _minIdle = minIdle;

            Initialize();
        }
 /// <summary>
 /// Creates an <see cref="ElasticResourcePool{TResource,TArguments}"/> instance initialized to pool from <see cref="Config"/> resource objects.
 /// <para>
 /// Resource object instances will be created using <see cref="IResourceFactory{TResource,TArguments}"/> <code>Create(object)</code>
 /// with the default arguments specified in <see cref="IResourceFactory{TResource,TArguments}"/> default arguments.
 /// </para>
 /// </summary>
 /// <param name="config">The <see cref="Config"/></param>
 /// <param name="factory">The resource object factory</param>
 public ElasticResourcePool(Config config, IResourceFactory <TResource, TArguments> factory) : this(config.MinIdle, factory)
 {
 }
 public DefaultResourceFactory_tests()
 {
     var dataStore = TestDataStore.Create();
     var identityMap = new MemoryCacheIdentityMap<ResourceData>(TimeSpan.FromSeconds(10), Substitute.For<ILogger>()); // arbitrary expiration time
     this.factory = new DefaultResourceFactory(dataStore, identityMap);
 }
 public RequestDeserializer(IResourceContextProvider contextProvider, IResourceFactory resourceFactory, ITargetedFields targetedFields, IHttpContextAccessor httpContextAccessor)
     : base(contextProvider, resourceFactory)
 {
     _targetedFields      = targetedFields;
     _httpContextAccessor = httpContextAccessor;
 }
 public static IQueryable <TSource> Select <TSource>(this IQueryable <TSource> source, IEnumerable <string> columns, IResourceFactory resourceFactory)
 {
     return(columns == null || !columns.Any() ? source : CallGenericSelectMethod(source, columns, resourceFactory));
 }
Пример #35
0
 /// <summary>
 /// Sets the value of the resource property this attributes was declared on.
 /// </summary>
 public virtual void SetValue(object resource, object newValue, IResourceFactory resourceFactory)
 {
     Property.SetValue(resource, newValue);
 }
        public LyricRepository(IMongoDataAccess mongoDataAccess, ITargetedFields targetedFields, IResourceGraph resourceGraph, IResourceFactory resourceFactory,
                               IEnumerable <IQueryConstraintProvider> constraintProviders, IResourceDefinitionAccessor resourceDefinitionAccessor)
            : base(mongoDataAccess, targetedFields, resourceGraph, resourceFactory, constraintProviders, resourceDefinitionAccessor)
        {
            IMongoDataAccess otherDataAccess = new MongoDataAccess(mongoDataAccess.MongoDatabase);

            var factory = new MongoTransactionFactory(otherDataAccess);

            _transaction = factory.BeginTransactionAsync(CancellationToken.None).Result;
        }
Пример #37
0
 public ResourceFactoryTests()
 {
     _mockHateoasContext      = new Mock <IHateoasContext>();
     _mockResourceLinkFactory = new Mock <IResourceLinkFactory>();
     _sut = new ResourceFactory(_mockHateoasContext.Object, _mockResourceLinkFactory.Object);
 }
Пример #38
0
 public CachingResourceFactory(IResourceFactory originalFactory = null)
 {
     this.originalFactory = originalFactory ?? (IResourceFactory) new ActivatorResourceFactory();
 }
        /// <summary>
        /// Obtain a RabbitMQ Channel that is synchronized with the current transaction, if any.
        /// </summary>
        /// <param name="connectionFactory">
        /// The connection factory.
        /// </param>
        /// <param name="resourceFactory">
        /// The resource factory.
        /// </param>
        /// <returns>
        /// The transactional Channel, or null if none found.
        /// </returns>
        /// <exception cref="AmqpException">
        /// </exception>
        private static RabbitResourceHolder DoGetTransactionalResourceHolder(IConnectionFactory connectionFactory, IResourceFactory resourceFactory)
        {
            AssertUtils.ArgumentNotNull(connectionFactory, "ConnectionFactory must not be null");
            AssertUtils.ArgumentNotNull(resourceFactory, "ResourceFactory must not be null");

            var resourceHolder = (RabbitResourceHolder)TransactionSynchronizationManager.GetResource(connectionFactory);
            if (resourceHolder != null)
            {
                var tempchannel = resourceFactory.GetChannel(resourceHolder);
                if (tempchannel != null)
                {
                    return resourceHolder;
                }
            }

            var resourceHolderToUse = resourceHolder;
            if (resourceHolderToUse == null)
            {
                resourceHolderToUse = new RabbitResourceHolder();
            }

            var connection = resourceFactory.GetConnection(resourceHolderToUse);
            IModel channel = null;
            try
            {
                bool isExistingCon = connection != null;
                if (!isExistingCon)
                {
                    connection = resourceFactory.CreateConnection();
                    resourceHolderToUse.AddConnection(connection);
                }
                channel = resourceFactory.CreateChannel(connection);
                resourceHolderToUse.AddChannel(channel, connection);

                if (resourceHolderToUse != resourceHolder)
                {
                    BindResourceToTransaction(resourceHolderToUse, connectionFactory, resourceFactory.IsSynchedLocalTransactionAllowed);
                }

                return resourceHolderToUse;

            }
            catch (Exception ex)
            {
                RabbitUtils.CloseChannel(channel);
                RabbitUtils.CloseConnection(connection);
                throw;
            }
        }
Пример #40
0
        private static RabbitResourceHolder DoGetTransactionalResourceHolder(IConnectionFactory connectionFactory, IResourceFactory resourceFactory)
        {
            if (connectionFactory == null)
            {
                throw new ArgumentNullException(nameof(connectionFactory));
            }

            if (resourceFactory == null)
            {
                throw new ArgumentNullException(nameof(resourceFactory));
            }

            var resourceHolder = (RabbitResourceHolder)TransactionSynchronizationManager.GetResource(connectionFactory);

            if (resourceHolder != null)
            {
                var model = resourceFactory.GetChannel(resourceHolder);
                if (model != null)
                {
                    return(resourceHolder);
                }
            }

            var resourceHolderToUse = resourceHolder;

            if (resourceHolderToUse == null)
            {
                resourceHolderToUse = new RabbitResourceHolder();
            }

            var    connection = resourceFactory.GetConnection(resourceHolderToUse);
            IModel channel;

            try
            {
                /*
                 * If we are in a listener container, first see if there's a channel registered
                 * for this consumer and the consumer is using the same connection factory.
                 */
                channel = ConsumerChannelRegistry.GetConsumerChannel(connectionFactory);
                if (channel == null && connection == null)
                {
                    connection = resourceFactory.CreateConnection2();
                    if (resourceHolder == null)
                    {
                        /*
                         * While creating a connection, a connection listener might have created a
                         * transactional channel and bound it to the transaction.
                         */
                        resourceHolder = (RabbitResourceHolder)TransactionSynchronizationManager.GetResource(connectionFactory);
                        if (resourceHolder != null)
                        {
                            channel             = resourceHolder.GetChannel();
                            resourceHolderToUse = resourceHolder;
                        }
                    }

                    resourceHolderToUse.AddConnection(connection);
                }

                if (channel == null)
                {
                    channel = resourceFactory.CreateChannel(connection);
                }

                resourceHolderToUse.AddChannel(channel, connection);

                if (!resourceHolderToUse.Equals(resourceHolder))
                {
                    BindResourceToTransaction(resourceHolderToUse, connectionFactory, resourceFactory.IsSynchedLocalTransactionAllowed);
                }

                return(resourceHolderToUse);
            }
            catch (IOException ex)
            {
                RabbitUtils.CloseConnection(connection);
                throw new AmqpIOException(ex);
            }
        }
 protected BaseDocumentParser(IResourceContextProvider contextProvider, IResourceFactory resourceFactory)
 {
     _contextProvider = contextProvider;
     _resourceFactory = resourceFactory;
 }
Пример #42
0
        public IBuilding CreateBuilding(string buildingType, IUnitFactory unitFactory, IResourceFactory resourceFactory)
        {
            switch (buildingType)
            {
            case "archery":
                return(new Archery(unitFactory, resourceFactory));

            case "barracks":
                return(new Barracks(unitFactory, resourceFactory));

            default:
                throw new ArgumentException("Unknown building type.");
            }
        }
        public ResourceHookExecutorFacade(IResourceHookExecutor resourceHookExecutor, IResourceFactory resourceFactory)
        {
            ArgumentGuard.NotNull(resourceHookExecutor, nameof(resourceHookExecutor));
            ArgumentGuard.NotNull(resourceFactory, nameof(resourceFactory));

            _resourceHookExecutor = resourceHookExecutor;
            _resourceFactory      = resourceFactory;
        }
        private static IQueryable <TSource> CallGenericSelectMethod <TSource>(IQueryable <TSource> source, IEnumerable <string> columns, IResourceFactory resourceFactory)
        {
            var sourceType       = typeof(TSource);
            var parameter        = Expression.Parameter(source.ElementType, "x");
            var sourceProperties = new HashSet <string>();

            // Store all property names to it's own related property (name as key)
            var nestedTypesAndProperties = new Dictionary <string, HashSet <string> >();

            foreach (var column in columns)
            {
                var props = column.Split('.');
                if (props.Length > 1) // Nested property
                {
                    if (nestedTypesAndProperties.TryGetValue(props[0], out var properties) == false)
                    {
                        nestedTypesAndProperties.Add(props[0], new HashSet <string> {
                            nameof(Identifiable.Id), props[1]
                        });
                    }
                    else
                    {
                        properties.Add(props[1]);
                    }
                }
                else
                {
                    sourceProperties.Add(props[0]);
                }
            }

            // Bind attributes on TSource
            var sourceBindings = sourceProperties.Select(prop => Expression.Bind(sourceType.GetProperty(prop), Expression.PropertyOrField(parameter, prop))).ToList();

            // Bind attributes on nested types
            var nestedBindings = new List <MemberAssignment>();

            foreach (var item in nestedTypesAndProperties)
            {
                var nestedProperty     = sourceType.GetProperty(item.Key);
                var nestedPropertyType = nestedProperty.PropertyType;
                // [HasMany] attribute
                Expression bindExpression;
                if (nestedPropertyType != typeof(string) && typeof(IEnumerable).IsAssignableFrom(nestedPropertyType))
                {
                    var collectionElementType = nestedPropertyType.GetGenericArguments().Single();
                    // {y}
                    var nestedParameter = Expression.Parameter(collectionElementType, "y");
                    nestedBindings = item.Value.Select(prop => Expression.Bind(
                                                           collectionElementType.GetProperty(prop), Expression.PropertyOrField(nestedParameter, prop))).ToList();

                    // { new Item() }
                    var newNestedExp  = resourceFactory.CreateNewExpression(collectionElementType);
                    var initNestedExp = Expression.MemberInit(newNestedExp, nestedBindings);
                    // { y => new Item() {Id = y.Id, Name = y.Name}}
                    var body = Expression.Lambda(initNestedExp, nestedParameter);
                    // { x.Items }
                    Expression propertyExpression = Expression.Property(parameter, nestedProperty.Name);
                    // { x.Items.Select(y => new Item() {Id = y.Id, Name = y.Name}) }
                    Expression selectMethod = Expression.Call(
                        typeof(Enumerable),
                        "Select",
                        new[] { collectionElementType, collectionElementType },
                        propertyExpression, body);

                    var enumerableOfElementType    = typeof(IEnumerable <>).MakeGenericType(collectionElementType);
                    var typedCollection            = nestedPropertyType.ToConcreteCollectionType();
                    var typedCollectionConstructor = typedCollection.GetConstructor(new[] { enumerableOfElementType });

                    // { new HashSet<Item>(x.Items.Select(y => new Item() {Id = y.Id, Name = y.Name})) }
                    bindExpression = Expression.New(typedCollectionConstructor, selectMethod);
                }
                // [HasOne] attribute
                else
                {
                    // {x.Owner}
                    var srcBody = Expression.PropertyOrField(parameter, item.Key);
                    foreach (var nested in item.Value)
                    {
                        // {x.Owner.Name}
                        var nestedBody = Expression.PropertyOrField(srcBody, nested);
                        var propInfo   = nestedPropertyType.GetProperty(nested);
                        nestedBindings.Add(Expression.Bind(propInfo, nestedBody));
                    }
                    // { new Owner() }
                    var newExp = resourceFactory.CreateNewExpression(nestedPropertyType);
                    // { new Owner() { Id = x.Owner.Id, Name = x.Owner.Name }}
                    var newInit = Expression.MemberInit(newExp, nestedBindings);

                    // Handle nullable relationships
                    // { Owner = x.Owner == null ? null : new Owner() {...} }
                    bindExpression = Expression.Condition(
                        Expression.Equal(srcBody, Expression.Constant(null)),
                        Expression.Convert(Expression.Constant(null), nestedPropertyType),
                        newInit
                        );
                }

                sourceBindings.Add(Expression.Bind(nestedProperty, bindExpression));
                nestedBindings.Clear();
            }

            var newExpression = resourceFactory.CreateNewExpression(sourceType);
            var sourceInit    = Expression.MemberInit(newExpression, sourceBindings);
            var finalBody     = Expression.Lambda(sourceInit, parameter);

            return(source.Provider.CreateQuery <TSource>(Expression.Call(
                                                             typeof(Queryable),
                                                             "Select",
                                                             new[] { source.ElementType, typeof(TSource) },
                                                             source.Expression,
                                                             Expression.Quote(finalBody))));
        }
 public RequestDeserializer(IResourceContextProvider resourceContextProvider, IResourceFactory resourceFactory, ITargetedFields targetedFields, IHttpContextAccessor httpContextAccessor)
     : base(resourceContextProvider, resourceFactory)
 {
     _targetedFields      = targetedFields ?? throw new ArgumentNullException(nameof(targetedFields));
     _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
 }
Пример #46
0
 public Barracks(IResourceFactory resourceFactory, IUnitFactory unitFactory)
     : base(unitType, resourceType, unitCycle, resourceCycle, resourceQuantity, resourceFactory, unitFactory)
 {
 }
Пример #47
0
 internal ResourceFactoryWrapper(IResourceFactory factory, Processor proc)
 {
     this.resourceFactory = factory;
 }
		public void RegisterResourceFactory(IResourceFactory resourceFactory)
		{
			if (resourceFactory == null) throw new ArgumentNullException("resourceFactory");

			resourceFactories.Add( resourceFactory );
		}
Пример #49
0
        public IBuilding CreateBuilding(string buildingType, IUnitFactory unitFactory, IResourceFactory resourceFactory)
        {
            var type = Assembly.GetExecutingAssembly().GetTypes()
                       .FirstOrDefault(t => t.Name.ToLowerInvariant() == buildingType);

            if (type == null)
            {
                throw new ArgumentException("Unknown building type.");
            }

            var building = (IBuilding)Activator.CreateInstance(type, unitFactory, resourceFactory);

            return(building);
        }
Пример #50
0
 public Archery(IUnitFactory unitFactory, IResourceFactory resourceFactory)
     : base(ArcheryUnitType, ArcheryUnitCicleLength, ArcheryResourceType, ArcheryResourceCicleLength, ArcheryResourceQuantity,
            unitFactory, resourceFactory)
 {
 }
Пример #51
0
 public DataDictionaryRepo(IResourceFactory resourceFactory)
 {
     _resourceFactory = resourceFactory;
 }
Пример #52
0
 public CssLinksProcessor(IResourceFactory factory, IRelativePathProducer relativePathProducer, IResourcesStack resourcesStack, Uri initialHostUri)
     : base(factory, relativePathProducer, resourcesStack, initialHostUri)
 {
 }
Пример #53
0
		public CachingResourceFactory(IResourceFactory originalFactory = null)
		{
			this.originalFactory = originalFactory ?? (IResourceFactory)new ActivatorResourceFactory();
		}
 public TestDocumentParser(IResourceGraph resourceGraph, IResourceFactory resourceFactory) : base(resourceGraph, resourceFactory)
 {
 }
Пример #55
0
 public Barracks(IUnitFactory unitFactory, IResourceFactory resourceFactory)
     : base(ResourceType, ResourceProduceTime, resourceQuantity, UnitType, UnitProduceTime, unitFactory, resourceFactory)
 {
 }
Пример #56
0
 //public ResourceLog(bool caseSensitive)
 public ResourceLog(IResourceFactory resourceFactory)
 {
     this.Items = new List <IResource>();
     //this.CaseSensitive = caseSensitive;
 }
Пример #57
0
 protected FactoryResourceSourceBase(IFactoryResourceCache factoryResourceCache, TFactory factory)
 {
     this.factoryResourceCache = factoryResourceCache;
     Factory = factory;
 }
Пример #58
0
 /// <summary>
 /// Initialize table operations with access to all registered resource types.
 /// </summary>
 /// <param name="resourceFactory">Get resource from the connector.</param>
 /// <param name="requestQuery">Get query string information for odata operations.</param>
 public TableOperations(IResourceFactory resourceFactory, IRequestQueryStringService requestQuery)
 {
     ResourceFactory = resourceFactory;
     _requestQuery   = requestQuery;
 }
Пример #59
0
 protected BaseDeserializer(IResourceContextProvider resourceContextProvider, IResourceFactory resourceFactory)
 {
     ResourceContextProvider = resourceContextProvider ?? throw new ArgumentNullException(nameof(resourceContextProvider));
     ResourceFactory         = resourceFactory ?? throw new ArgumentNullException(nameof(resourceFactory));
 }
        public static object ConvertStringIdToTypedId(Type resourceType, string stringId, IResourceFactory resourceFactory)
        {
            var tempResource = (IIdentifiable)resourceFactory.CreateInstance(resourceType);

            tempResource.StringId = stringId;
            return(GetResourceTypedId(tempResource));
        }