DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
SystemContextExtensions.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 using System.Collections.Generic;
19 
20 using Deveel.Data.Caching;
22 using Deveel.Data.Services;
23 using Deveel.Data.Sql.Compile;
24 using Deveel.Data.Sql.Query;
25 
26 namespace Deveel.Data {
27  public static class SystemContextExtensions {
28  public static IDatabaseContext CreateDatabaseContext(this ISystemContext context, string name) {
29  var dbConfig = new Configuration.Configuration();
30  dbConfig.SetValue("database.name", name);
31  return context.CreateDatabaseContext(dbConfig);
32  }
33 
34  #region Configurations
35 
36  public static bool ReadOnly(this ISystemContext context) {
37  return context.Configuration.GetBoolean("system.readOnly", false);
38  }
39 
40  public static bool IgnoreIdentifiersCase(this ISystemContext context) {
41  return context.Configuration.GetBoolean("system.ignoreIdCase", true);
42  }
43 
44  // TODO: remove this from here...
45  public static string DefaultSchema(this ISystemContext context) {
46  return context.Configuration.GetString("database.defaultSchema","APP");
47  }
48 
49  public static bool AutoCommit(this ISystemContext context) {
50  return context.Configuration.GetBoolean("system.autoCommit");
51  }
52 
53  #endregion
54  }
55 }
static IDatabaseContext CreateDatabaseContext(this ISystemContext context, string name)
The context of a single database within a system.
The execution context of a database system, that is defining the configurations and the components us...
static bool ReadOnly(this ISystemContext context)
static string DefaultSchema(this ISystemContext context)
IDatabaseContext CreateDatabaseContext(IConfiguration configuration)
static bool AutoCommit(this ISystemContext context)
static bool IgnoreIdentifiersCase(this ISystemContext context)
Configuration(bool isRoot)
Constructs the Configuration.