public void Add(IFeatureSchema feature) { if (!_features.ContainsKey(feature.StorageType)) { _features[feature.StorageType] = feature; } }
public static void AssertValidNames(this IFeatureSchema schema, StoreOptions options) { foreach (var objectName in schema.Objects.SelectMany(x => x.AllNames())) { options.AssertValidIdentifier(objectName.Name); } }
public static void WriteDropStatements(this IFeatureSchema schema, DdlRules rules, StringWriter writer) { foreach (var schemaObject in schema.Objects) { schemaObject.WriteDropStatement(rules, writer); } }
private void generateOrUpdateFeature(Type featureType, IFeatureSchema feature) { lock (_updateLock) { using (var conn = _factory.Create()) { conn.Open(); var patch = new SchemaPatch(_options.DdlRules); patch.Apply(conn, _options.AutoCreateSchemaObjects, feature.Objects); patch.AssertPatchingIsValid(_options.AutoCreateSchemaObjects); var ddl = patch.UpdateDDL; if (patch.Difference != SchemaPatchDifference.None && ddl.IsNotEmpty()) { var cmd = conn.CreateCommand(ddl); try { cmd.ExecuteNonQuery(); _options.Logger().SchemaChange(ddl); RegisterCheck(featureType, feature); } catch (Exception e) { throw new MartenCommandException(cmd, e); } } else if (patch.Difference == SchemaPatchDifference.None) { RegisterCheck(featureType, feature); } } } }
private void RegisterCheck(Type featureType, IFeatureSchema feature) { _checks[featureType] = true; if (feature.StorageType != featureType) { _checks[feature.StorageType] = true; } }
public static void Write(this IFeatureSchema schema, DdlRules rules, StringWriter writer) { foreach (var schemaObject in schema.Objects) { schemaObject.Write(rules, writer); } schema.WritePermissions(rules, writer); }
public static void RemoveAllObjects(this IFeatureSchema schema, DdlRules rules, NpgsqlConnection conn) { var writer = new StringWriter(); schema.WriteDropStatements(rules, writer); var sql = writer.ToString(); var cmd = conn.CreateCommand(sql); try { cmd.ExecuteNonQuery(); } catch (Exception e) { throw MartenCommandExceptionFactory.Create(cmd, e); } }
/// <summary> /// Register custom storage features /// </summary> /// <param name="feature"></param> public void Add(IFeatureSchema feature) { _features.Add(feature.StorageType, feature); }
public static void AssertValidNames(this IFeatureSchema schema, StoreOptions options) { AssertValidNames(schema.Objects, options); }
private void store(IFeatureSchema feature) { _features.Add(feature.StorageType, feature); }