Beispiel #1
0
        public void Query_with_contains_operator()
        {
            var schema = SchemaFactory.New("items").PrimaryKey("id")
                         .WithServerSideValue("tags")
                         .Build();

            {
                var query = new Parser().ParseSql("select from items where tags contains 'geek' or tags contains electronics").ToQuery(schema);

                Assert.AreEqual("items", query.CollectionName);

                var q = FindAtomicQuery(query, "tags");

                Assert.AreEqual(QueryOperator.Contains, q.Operator);
                Assert.IsTrue(q.Values.All(v => v.Type == KeyValue.OriginalType.String));
            }

            {
                var query = new Parser().ParseSql("select * from items where tags not contains 'geek'").ToQuery(schema);

                var q = FindAtomicQuery(query, "tags");

                Assert.AreEqual(QueryOperator.NotContains, q.Operator);
                Assert.IsTrue(q.Values.All(v => v.Type == KeyValue.OriginalType.String));
            }
        }
Beispiel #2
0
        public Rule AddRule(RuleTypeEnum ruleType)
        {
            Rule rule = SchemaFactory.CreateRule(ruleType);

            this.Add(rule);
            return(rule);
        }
        public SchemaFactoryTests()
        {
            _mockConfiguration.Setup(_ => _["ApplicationVersion"]).Returns("v2");

            _mockDistributedCacheExpirationConfiguration
            .Setup(_ => _.Value)
            .Returns(new DistributedCacheExpirationConfiguration
            {
                FormJson = 1
            });

            _mockDistributedCacheConfiguration
            .Setup(_ => _.Value)
            .Returns(new DistributedCacheConfiguration
            {
                UseDistributedCache = true
            });

            var formSchema = new FormSchemaBuilder()
                             .Build();

            _mockSchemaProvider
            .Setup(_ => _.Get <FormSchema>(It.IsAny <string>()))
            .ReturnsAsync(formSchema);

            _schemaFactory = new SchemaFactory(_mockDistributedCache.Object, _mockSchemaProvider.Object, _mockLookupSchemaFactory.Object, _mockReusableElementSchemaFactory.Object, _mockDistributedCacheConfiguration.Object, _mockDistributedCacheExpirationConfiguration.Object, _mockConfiguration.Object);
        }
Beispiel #4
0
        public void Query_with_in_operator()
        {
            var schema = SchemaFactory.New("collection").PrimaryKey("id")
                         .WithServerSideValue("a")
                         .WithServerSideValue("x", IndexType.Ordered)
                         .WithServerSideValue("age", IndexType.Ordered)
                         .WithServerSideValue("date", IndexType.Ordered)
                         .Build();

            {
                var query = new Parser().ParseSql("select from collection where a in (1, 2, 3)").ToQuery(schema);

                var q = FindAtomicQuery(query, "a");

                Assert.AreEqual(3, q.Values.Count);
                Assert.AreEqual(QueryOperator.In, q.Operator);
                Assert.IsTrue(q.Values.All(v => v.Type == KeyValue.OriginalType.SomeInteger));
            }

            {
                var query = new Parser().ParseSql("select from collection where a not  in (1, 2, 3)").ToQuery(schema);

                var q = FindAtomicQuery(query, "a");

                Assert.AreEqual(3, q.Values.Count);
                Assert.AreEqual(QueryOperator.NotIn, q.Operator);
                Assert.IsTrue(q.Values.All(v => v.Type == KeyValue.OriginalType.SomeInteger));
            }
        }
Beispiel #5
0
        public Rule AddCustomRule(string ruleType, string ruleValue, string exProperty)
        {
            Rule rule = SchemaFactory.CreateCustomRule(ruleType, ruleValue, exProperty);

            this.Add(rule);
            return(rule);
        }
Beispiel #6
0
        public Field AddField(FieldTypeEnum fieldEnum)
        {
            Field field = SchemaFactory.CreateField(fieldEnum);

            this.Add(field);
            return(field);
        }
Beispiel #7
0
 private static OpenApiComponents Components()
 {
     return(new OpenApiComponents
     {
         Schemas = SchemaFactory.CkanSchemas()
     });
 }
Beispiel #8
0
        public Rule AddRule(RuleTypeEnum ruleType, string value)
        {
            Rule rule = SchemaFactory.CreateRule(ruleType);

            rule.Value = value;
            this.Add(rule);
            return(rule);
        }
Beispiel #9
0
        public Rule AddRule(RuleTypeEnum ruleType, string value, string exProperty)
        {
            Rule rule = SchemaFactory.CreateRule(ruleType);

            rule.Value      = value;
            rule.ExProperty = exProperty;
            this.Add(rule);
            return(rule);
        }
        private ISchema CreateSchema()
        {
            var props = new List <IPropertyInfo> {
                SchemaFactory.PropertyFactory.Create <IGeometry>("Geom")
            };

            props.AddRange(_dbfHeader.Fields.Select(a => SchemaFactory.PropertyFactory.Create(a.Type, a.Name)));

            return(SchemaFactory.Create(props, props.FirstOrDefault(a => a.Name == "OID")));
        }
Beispiel #11
0
        public static void Read(
            Catalog catalog,
            IDataReader reader)
        {
            var factory = new SchemaFactory(reader);

            while (reader.Read())
            {
                factory.CreateSchema(catalog, reader);
            }
        }
Beispiel #12
0
        private void LoadTable()
        {
            Debug.Print("Init connection...");
            var setting = GetConnectionSetting();

            SaveWorking(setting);
            Query.Init(setting);
            Debug.Print("Begin load tables... for type:" + providerType);
            tables = SchemaFactory.GetTables(DatabaseProvider.INSTANCE.GetConnection(), setting.Type);
            Debug.Print(String.Format("Found: {0} table", tables.Count));
        }
Beispiel #13
0
 public TestModelParser()
 {
     this.schemaFactory = SchemaFactory.newInstance(W3C_XML_SCHEMA);
     try
     {
         addSchema(TEST_NS, schemaFactory.newSchema(ReflectUtil.getResource(SCHEMA_LOCATION)));
     }
     catch (SAXException e)
     {
         throw new ModelValidationException("Unable to parse schema:" + ReflectUtil.getResource(SCHEMA_LOCATION), e);
     }
 }
Beispiel #14
0
        private static IJsonSchema _FromJson(JsonValue json, SchemaFactory schemaFactory, Uri documentPath = null)
        {
            if (json == null)
            {
                return(null);
            }
            IJsonSchema schema = null;

            switch (json.Type)
            {
            case JsonValueType.Object:
                var schemaDeclaration = json.Object.TryGetString("$schema");
                var factory           = _schemaFactories.FirstOrDefault(f => f.Id == schemaDeclaration);
                if (factory != null)
                {
                    var id = json.Object.TryGetString(factory.IdKey);
                    if (id == factory.MetaSchema.Id)
                    {
                        return(factory.MetaSchema);
                    }
                    schema = factory.Factory();
                }
                schema = schema ?? schemaFactory.Factory();
                if (json.Object.ContainsKey("$ref"))
                {
                    schema = json.Object.Count > 1
                                                                 ? new JsonSchemaReference(schema.GetType())
                    {
                        Base = schema
                    }
                }
                : new JsonSchemaReference(schema.GetType());
                break;

            case JsonValueType.Array:
                schema = new JsonSchemaCollection();
                break;

            case JsonValueType.Boolean:
                // not determining draft here is fine
                // True is intended to pass all instances
                // False is intended to fail all instances
                schema = new JsonSchema06();
                break;

            default:
                throw new SchemaLoadException($"JSON Schema must be objects; actual type: {json.Type}");
            }
            schema.DocumentPath = documentPath;
            schema.FromJson(json, null);
            return(schema);
        }
Beispiel #15
0
        public void Select_to_query()
        {
            var schema = SchemaFactory.New("collection").PrimaryKey("id")
                         .WithServerSideValue("a")
                         .WithServerSideValue("x", IndexType.Ordered)
                         .WithServerSideValue("age", IndexType.Ordered)
                         .WithServerSideValue("date", IndexType.Ordered)
                         .Build();

            var result = new Parser().ParseSql("select from collection where a<>'ttt' or x < 1.22 and x >= 0,5 or age > 18 ");

            var query = result.ToQuery(schema);

            Assert.AreEqual("collection", query.CollectionName);

            Assert.IsTrue(query.IsValid);

            var result1 = new Parser().ParseSql("select * from collection where a != 'ttt' or x < 1.22 and x >= 0,5 or age > 18 ");

            var query1 = result1.ToQuery(schema);

            // the two queries must be identical
            Assert.AreEqual(query.ToString(), query1.ToString());

            // check if the atomic queries have been correctly generated
            var q1 = FindAtomicQuery(query, "a");

            Assert.NotNull(q1);
            Assert.AreEqual(KeyValue.OriginalType.String, q1.Value.Type);
            Assert.AreEqual(QueryOperator.NotEq, q1.Operator);

            var q2 = FindAtomicQuery(query, "x");

            Assert.NotNull(q2);
            Assert.AreEqual(KeyValue.OriginalType.SomeFloat, q2.Value.Type);
            Assert.AreEqual(QueryOperator.GeLt, q2.Operator, "query should be optimized as range operator");

            var q3 = FindAtomicQuery(query, "age");

            Assert.NotNull(q3);
            Assert.AreEqual(KeyValue.OriginalType.SomeInteger, q3.Value.Type);
            Assert.AreEqual(QueryOperator.Gt, q3.Operator);

            var query2 = new Parser().ParseSql("select * from collection where date = 2012-01-31 ").ToQuery(schema);
            var q4     = FindAtomicQuery(query2, "date");

            Assert.NotNull(q4);
            Assert.AreEqual(KeyValue.OriginalType.Date, q4.Value.Type);
            Assert.AreEqual(QueryOperator.Eq, q4.Operator);
        }
Beispiel #16
0
        /// <summary>
        /// Registers a schema with an extended vocabulary so that it can be deserialized properly.
        /// </summary>
        /// <typeparam name="T">The schema type.</typeparam>
        /// <param name="id">The schema's ID.</param>
        /// <param name="factory">A factory function for creating instances.</param>
        /// <param name="metaSchema">Optional - A meta-schema instance for this schema.</param>
        public static void RegisterExtendedSchema <T>(string id, Func <T> factory, T metaSchema = default(T))
            where T : IJsonSchema
        {
            var schemaFactory = new SchemaFactory
            {
                Factory    = () => factory(),
                SchemaType = typeof(T),
                Id         = id,
                IdKey      = typeof(JsonSchema04).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo()) ? "id" : "$id",
                MetaSchema = metaSchema
            };

            _schemaFactories.Add(schemaFactory);
        }
Beispiel #17
0
        public static async Task ReadAsync(
            Catalog catalog,
            DbDataReader reader,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();
            var factory = new SchemaFactory(reader);

            while (await reader.ReadAsync(cancellationToken))
            {
                cancellationToken.ThrowIfCancellationRequested();
                factory.CreateSchema(catalog, reader);
            }
        }
Beispiel #18
0
        public void Convert()
        {
            //var chat = new ChatSchema(new Chat());
            //var types = chat.AllTypes;

            var service           = new GraphServiceDescriptor(typeof(DemoGraphService));
            var serviceProvider   = new ServiceCollection().BuildServiceProvider();
            var graphTypeProvider = new GraphTypeProvider(serviceProvider, new AttributeAccessor(), Options.Create(new GraphOptions()));
            var factory           = new SchemaFactory(new AttributeAccessor(), graphTypeProvider, new ArgumentBinderProvider(new IArgumentBinder[] { new GraphArgumentBinder() }));
            var schema            = factory.Create(new GraphServiceDescriptor[] { service });

            var converter       = new GraphSchemaConverter(graphTypeProvider);
            var convertedSchema = converter.Convert(schema);
            var types           = convertedSchema.AllTypes;
        }
Beispiel #19
0
        private DbTable GetDbTableTemp()
        {
            var dbTable = new DbTable("table_test", "schema_test", new List <DbColumn>()
            {
                new DbColumn("column1", DbType.String, true, false, false, false),
                new DbColumn("column2", DbType.String, true, false, false, false),
                new DbColumn("primary_column", DbType.Int64, false, true, true, false)
            });

            foreach (var item in dbTable.Columns)
            {
                item.ColumnTypeName = SchemaFactory.GetColumnTypeName(item.DbType, "table_test", item.IsPrimaryKey, item.Nullable);
            }
            return(dbTable);
        }
Beispiel #20
0
        public Rule AddIntervalRule(RuleTypeEnum ruleType, string ruleValue, bool isInclude)
        {
            Rule rule = SchemaFactory.CreateRule(ruleType);

            rule.Value = ruleValue;
            if (isInclude)
            {
                rule.ExProperty = "include";
            }
            else
            {
                rule.ExProperty = "not include";
            }
            this.Add(rule);
            return(rule);
        }
        public void Test_manual_schema_factory()
        {
            var schema = SchemaFactory.New("heroes")
                         .PrimaryKey("id")
                         .WithServerSideCollection("tags")
                         .WithServerSideValue("name", IndexType.Dictionary)
                         .WithServerSideValue("age", IndexType.Ordered)
                         .EnableFullTextSearch("tags", "name")
                         .Build();

            // order is preserved for scalars
            Assert.Less(schema.OrderOf("name"), schema.OrderOf("age"));

            // collections come after all scalar properties
            Assert.Less(schema.OrderOf("age"), schema.OrderOf("tags"));
        }
 private DataServiceController(DSConfiguration settings, CustomAuthorizationHandler.ICustomContextStore customContextStore, ISchemaBuilder testSchemaBuilder)
 {
     TraceHelper.Current.CorrelateWithActivity(EtwActivity.GetActivityId());
     try
     {
         this.Configuration = settings;
         this.cmdManagers   = new Dictionary <ManagementSystemType, ICommandManager>();
         this.PerfCounters  = new PerfCounters(CurrentRequestHelper.EndPointAddress);
         this.UserDataCache = new UserDataCache(this.Configuration.Invocation.Lifetime);
         this.QuotaSystem   = new QuotaSystem();
         InitialSessionStateManager initialSessionStateManager = new InitialSessionStateManager(this.Configuration.PowerShell.SessionConfig.Assembly, this.Configuration.PowerShell.SessionConfig.Type);
         this.intialSessionStateStore = new SharedItemStore <InitialSessionState, UserContext>(initialSessionStateManager, this.Configuration.Quotas.UserSchemaTimeout, this.Configuration.Quotas.MaxUserSchemas);
         PSRunspaceFactory pSRunspaceFactory = new PSRunspaceFactory(this.intialSessionStateStore, true);
         int runspaceTimeout = this.Configuration.PowerShell.Quotas.RunspaceTimeout;
         ExclusiveItemStore <PSRunspace, UserContext> exclusiveItemStore = new ExclusiveItemStore <PSRunspace, UserContext>(pSRunspaceFactory, runspaceTimeout, this.Configuration.PowerShell.Quotas.MaxRunspaces);
         PSCommandManager pSCommandManager = new PSCommandManager(exclusiveItemStore);
         this.cmdManagers.Add(ManagementSystemType.PowerShell, pSCommandManager);
         PSRunspaceFactory pSRunspaceFactory1 = new PSRunspaceFactory(this.intialSessionStateStore, false);
         ExclusiveItemStore <PSRunspace, UserContext> exclusiveItemStore1 = new ExclusiveItemStore <PSRunspace, UserContext>(pSRunspaceFactory1, runspaceTimeout, this.Configuration.PowerShell.Quotas.MaxRunspaces);
         this.cmdManagers.Add(ManagementSystemType.GenericInvoke, new GICommandManager(exclusiveItemStore1));
         List <ISchemaBuilder> schemaBuilders = new List <ISchemaBuilder>();
         if (testSchemaBuilder != null)
         {
             schemaBuilders.Add(testSchemaBuilder);
         }
         schemaBuilders.Add(new PSSchemaBuilder(exclusiveItemStore));
         schemaBuilders.Add(new GISchemaBuilder());
         SchemaFactory schemaFactory = new SchemaFactory(this.Configuration.SchemaFileName, this.Configuration.ResourceMappingFileName, schemaBuilders, settings);
         this.schemaStore = new SharedItemStore <Microsoft.Management.Odata.Schema.Schema, UserContext>(schemaFactory, this.Configuration.Quotas.UserSchemaTimeout, this.Configuration.Quotas.MaxUserSchemas);
         this.customAuthorizationHandler = new CustomAuthorizationHandler(this.Configuration.CustomAuthorization.Assembly, this.Configuration.CustomAuthorization.Type, customContextStore);
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         TraceHelper.Current.DataServiceControllerCreationFailedOperational(exception.Message);
         if (TraceHelper.IsEnabled(5))
         {
             TraceHelper.Current.DebugMessage(exception.ToTraceMessage("DataServiceController failed to create"));
         }
         if (this.PerfCounters != null)
         {
             this.PerfCounters.Dispose();
         }
         throw;
     }
     TraceHelper.Current.DataServiceControllerCreationSucceeded();
 }
Beispiel #23
0
        public void Other_query_operators()
        {
            var schema = SchemaFactory.New("collection").PrimaryKey("id")
                         .WithServerSideValue("a")
                         .WithServerSideValue("x", IndexType.Ordered)
                         .WithServerSideValue("age", IndexType.Ordered)
                         .WithServerSideValue("date", IndexType.Ordered)
                         .Build();

            {
                var query = new Parser().ParseSql("select * from collection order by age take 10").ToQuery(schema);

                // no where clause
                Assert.AreEqual(0, query.Elements.Count);

                Assert.AreEqual(10, query.Take);
                Assert.AreEqual("age", query.OrderByProperty);
                Assert.IsFalse(query.OrderByIsDescending);
            }

            {
                var query = new Parser().ParseSql("select * from collection order by age descending").ToQuery(schema);

                // no where clause
                Assert.AreEqual(0, query.Elements.Count);

                Assert.AreEqual(0, query.Take); // no take clause
                Assert.AreEqual("age", query.OrderByProperty);
                Assert.IsTrue(query.OrderByIsDescending);
            }

            {
                var query = new Parser().ParseSql("select distinct a, x from collection").ToQuery(schema);

                // no where clause
                Assert.AreEqual(0, query.Elements.Count);

                Assert.AreEqual(0, query.Take); // no take clause

                Assert.AreEqual(2, query.SelectClause.Count);
                Assert.AreEqual("a", query.SelectClause[0].Name);
                Assert.AreEqual("x", query.SelectClause[1].Name);
                Assert.IsTrue(query.Distinct);
            }
        }
        public void FluentDescriptionIsEquivalentToTheOldOne()
        {
            var description = SchemaFactory.New("Order")
                              .PrimaryKey("Id")
                              .WithServerSideValue("Amount", IndexType.Ordered)
                              .WithServerSideValue("Quantity")
                              .WithServerSideValue("Category", IndexType.Dictionary)
                              .WithServerSideValue("ProductId", IndexType.Dictionary)
                              .WithServerSideValue("ClientId", IndexType.Dictionary)
                              .WithServerSideValue("Date", IndexType.Dictionary)
                              .WithServerSideValue("DayOfWeek", IndexType.Dictionary)
                              .WithServerSideValue("Month", IndexType.Dictionary)
                              .WithServerSideValue("Year", IndexType.Dictionary)
                              .WithServerSideValue("IsDelivered", IndexType.Dictionary)
                              .Build();

            var description1 = TypedSchemaFactory.FromType <Order>();

            Assert.AreEqual(description, description1);
        }
        public async Task <Response <SchemaProgress> > Handle(
            JoinSchemaCommand request,
            CancellationToken cancellationToken)
        {
            var schema = await _shopStore.GetSchema(request.SchemaId);

            var assignedSchema = SchemaFactory.Resolve(schema);

            if (!assignedSchema.Valid(_dateTime))
            {
                return(Response.Fail <SchemaProgress>("Schema not valid"));
            }

            if (await _userStore.InSchemaAsync(request.UserId, request.SchemaId))
            {
                return(Response.Fail <SchemaProgress>("Schema already joined"));
            }

            var progress = await _userStore.CreateSchemaProgressAsync(request.UserId, request.SchemaId);

            return(Response.Ok(progress, "Schema Joined"));
        }
        public async Task <Response <string> > Handle(InitiateRedemptionCommand request, CancellationToken cancellationToken)
        {
            var progress = await _userStore.GetProgressAsync(request.UserId, request.SchemaId);

            var schema = await _shopStore.GetSchema(progress.SchemaId);

            var assignedSchema = SchemaFactory.Resolve(schema);

            if (!assignedSchema.Valid(_dateTime))
            {
                return(Response.Fail <string>("Schema not valid"));
            }

            if (!assignedSchema.ReachedGoal(progress.Progress))
            {
                return(Response.Fail <string>("Goal not reached"));
            }

            var code = await _codeStore.CreateRedemptionCode();

            return(Response.Ok(code, "Code Created"));
        }
Beispiel #27
0
        public void Projection_query()
        {
            var schema = SchemaFactory.New("collection").PrimaryKey("id")
                         .WithServerSideValue("a")
                         .WithServerSideValue("fx", IndexType.Ordered)
                         .WithServerSideValue("age", IndexType.Ordered)
                         .WithServerSideValue("date", IndexType.Ordered)
                         .Build();

            {
                var query = new Parser().ParseSql("select fx, age from collection where a in (1, 2, 3)").ToQuery(schema);

                var q = FindAtomicQuery(query, "a");

                Assert.AreEqual(3, q.Values.Count);
                Assert.AreEqual(QueryOperator.In, q.Operator);
                Assert.IsTrue(q.Values.All(v => v.Type == KeyValue.OriginalType.SomeInteger));

                Assert.AreEqual(2, query.SelectClause.Count);
                Assert.AreEqual("fx", query.SelectClause[0].Name);
                Assert.AreEqual("fx", query.SelectClause[0].Alias);
            }

            {
                // same with alias
                var query = new Parser().ParseSql("select fx forex, age from collection where a in (1, 2, 3)").ToQuery(schema);

                var q = FindAtomicQuery(query, "a");

                Assert.AreEqual(3, q.Values.Count);
                Assert.AreEqual(QueryOperator.In, q.Operator);
                Assert.IsTrue(q.Values.All(v => v.Type == KeyValue.OriginalType.SomeInteger));

                Assert.AreEqual(2, query.SelectClause.Count);
                Assert.AreEqual("fx", query.SelectClause[0].Name);
                Assert.AreEqual("forex", query.SelectClause[0].Alias);
            }
        }
        public async Task <Response <Empty> > Handle(RewardCustomerCommand request, CancellationToken cancellationToken)
        {
            var progress = await _userStore.GetProgressAsync(request.UserId, request.SchemaId);

            var schema = await _shopStore.GetSchema(progress.SchemaId);

            var assignedSchema = SchemaFactory.Resolve(schema);

            if (!assignedSchema.Valid(_dateTime))
            {
                return(Response.Fail("Schema not valid"));
            }

            var result = await _codeStore.ValidateRewardCode(schema.ShopId, request.Code);

            if (!result.Success)
            {
                return(Response.Fail("Invalid Code"));
            }

            progress.Progress++;
            return(Response.Ok("Complete"));
        }
Beispiel #29
0
        public void Query_with_string_operators()
        {
            var schema = SchemaFactory.New("items").PrimaryKey("id")
                         .WithServerSideValue("name")
                         .Build();

            {
                var query = new Parser().ParseSql("select from items where name like john% ").ToQuery(schema);

                var q = FindAtomicQuery(query, "name");

                Assert.AreEqual(QueryOperator.StrStartsWith, q.Operator);
                Assert.AreEqual("john", q.Value.StringValue);
                Assert.AreEqual(KeyValue.OriginalType.String, q.Value.Type);
            }

            {
                var query = new Parser().ParseSql("select from items where name like %john ").ToQuery(schema);

                var q = FindAtomicQuery(query, "name");

                Assert.AreEqual(QueryOperator.StrEndsWith, q.Operator);
                Assert.AreEqual("john", q.Value.StringValue);
                Assert.AreEqual(KeyValue.OriginalType.String, q.Value.Type);
            }

            {
                var query = new Parser().ParseSql("select * from items where name like '%john%' ").ToQuery(schema);

                var q = FindAtomicQuery(query, "name");

                Assert.AreEqual(QueryOperator.StrContains, q.Operator);
                Assert.AreEqual("john", q.Value.StringValue);
                Assert.AreEqual(KeyValue.OriginalType.String, q.Value.Type);
            }
        }
Beispiel #30
0
 public override void InitDefaultField()
 {
     base.defaultValueField = SchemaFactory.CreateField(FieldTypeEnum.SINGLECHECK);
 }
Beispiel #31
0
		private DataServiceController(DSConfiguration settings, CustomAuthorizationHandler.ICustomContextStore customContextStore, ISchemaBuilder testSchemaBuilder)
		{
			TraceHelper.Current.CorrelateWithActivity(EtwActivity.GetActivityId());
			try
			{
				this.Configuration = settings;
				this.cmdManagers = new Dictionary<ManagementSystemType, ICommandManager>();
				this.PerfCounters = new PerfCounters(CurrentRequestHelper.EndPointAddress);
				this.UserDataCache = new UserDataCache(this.Configuration.Invocation.Lifetime);
				this.QuotaSystem = new QuotaSystem();
				InitialSessionStateManager initialSessionStateManager = new InitialSessionStateManager(this.Configuration.PowerShell.SessionConfig.Assembly, this.Configuration.PowerShell.SessionConfig.Type);
				this.intialSessionStateStore = new SharedItemStore<InitialSessionState, UserContext>(initialSessionStateManager, this.Configuration.Quotas.UserSchemaTimeout, this.Configuration.Quotas.MaxUserSchemas);
				PSRunspaceFactory pSRunspaceFactory = new PSRunspaceFactory(this.intialSessionStateStore, true);
				int runspaceTimeout = this.Configuration.PowerShell.Quotas.RunspaceTimeout;
				ExclusiveItemStore<PSRunspace, UserContext> exclusiveItemStore = new ExclusiveItemStore<PSRunspace, UserContext>(pSRunspaceFactory, runspaceTimeout, this.Configuration.PowerShell.Quotas.MaxRunspaces);
				PSCommandManager pSCommandManager = new PSCommandManager(exclusiveItemStore);
				this.cmdManagers.Add(ManagementSystemType.PowerShell, pSCommandManager);
				PSRunspaceFactory pSRunspaceFactory1 = new PSRunspaceFactory(this.intialSessionStateStore, false);
				ExclusiveItemStore<PSRunspace, UserContext> exclusiveItemStore1 = new ExclusiveItemStore<PSRunspace, UserContext>(pSRunspaceFactory1, runspaceTimeout, this.Configuration.PowerShell.Quotas.MaxRunspaces);
				this.cmdManagers.Add(ManagementSystemType.GenericInvoke, new GICommandManager(exclusiveItemStore1));
				List<ISchemaBuilder> schemaBuilders = new List<ISchemaBuilder>();
				if (testSchemaBuilder != null)
				{
					schemaBuilders.Add(testSchemaBuilder);
				}
				schemaBuilders.Add(new PSSchemaBuilder(exclusiveItemStore));
				schemaBuilders.Add(new GISchemaBuilder());
				SchemaFactory schemaFactory = new SchemaFactory(this.Configuration.SchemaFileName, this.Configuration.ResourceMappingFileName, schemaBuilders, settings);
				this.schemaStore = new SharedItemStore<Microsoft.Management.Odata.Schema.Schema, UserContext>(schemaFactory, this.Configuration.Quotas.UserSchemaTimeout, this.Configuration.Quotas.MaxUserSchemas);
				this.customAuthorizationHandler = new CustomAuthorizationHandler(this.Configuration.CustomAuthorization.Assembly, this.Configuration.CustomAuthorization.Type, customContextStore);
			}
			catch (Exception exception1)
			{
				Exception exception = exception1;
				TraceHelper.Current.DataServiceControllerCreationFailedOperational(exception.Message);
				if (TraceHelper.IsEnabled(5))
				{
					TraceHelper.Current.DebugMessage(exception.ToTraceMessage("DataServiceController failed to create"));
				}
				if (this.PerfCounters != null)
				{
					this.PerfCounters.Dispose();
				}
				throw;
			}
			TraceHelper.Current.DataServiceControllerCreationSucceeded();
		}