public A4ARepository(IServiceServer server) : base(server) { var connectionString = SqlTableWithPrimaryKey.GetConnectionString( (string)server.GetConfigProperty("DataDirectory", server.BucketId), server.BucketId, "A4ARepository"); underlying = new As.A4ACore.A4ARepository(connectionString); }
public A4ARepository(String connectionString) { L.Trace("Initializing types in assembly"); foreach (var type in A4ATypes) { tables[type] = new SqlTableWithPrimaryKey(new SqlitePropertiesAndCommands(TypeContainer.GetTypeContainer(type))); } primaryKeyAndTypeManager.AddPrimaryKeyPrefixAndEnum(typeof(A4AExpert), "E", A4APartyType.Expert) .AddPrimaryKeyPrefixAndEnum(typeof(A4AUser), "U", A4APartyType.User) .AddPrimaryKeyPrefixAndEnum(typeof(A4AAdministrator), "A", A4APartyType.Admin); GetTable <A4AExpert>().SetUniqueIdPrefix("EX"); GetTable <A4AUser>().SetUniqueIdPrefix("US"); GetTable <A4AAdministrator>().SetUniqueIdPrefix("AD"); GetTable <A4AMessage>().SetUniqueIdPrefix("MX"); GetTable <A4AEmailRecord>().SetUniqueIdPrefix("EM"); aggregateMessage = new SqlitePropertiesAndCommands(TypeContainer.GetTypeContainer(typeof(AggregateMessage))); conn = new SqlConnection(connectionString); L.Trace($"Initializing Sql - connectionString is {connectionString}"); using (var connection = conn.Connection()) { foreach (var c in tables.Keys) { tables[c].PropertiesAndCommands .VerifyForeignKeysFromOtherTables(tables.Values.Select(x => x.PropertiesAndCommands)); if (tables[c].TableExists(connection) == false) { tables[c].CreateTable(connection); } else { tables[c].UpdateTableStructure(connection); } } } }
public FuzzyMatcher(IServiceServer server) : base(server) { L.Trace( $"Opened server with bucket {server.BucketId} and data dir - {server.GetConfigProperty("DataDirectory",server.BucketId)}"); connectionString = SqlTableWithPrimaryKey.GetConnectionString((string)server.GetConfigProperty("DataDirectory", server.BucketId), server.BucketId, "AmlWorker"); L.Trace($"Initializing Sql - connectionString is {connectionString}"); using (var connection = newConnection()) { connection.Open(); if (!SqlTableWithPrimaryKey.TableExists(connection, "FuzzyPhrase")) { SqlTableWithPrimaryKey.ExecuteCommandLog(connection, FuzzyPhraseCreate); SqlTableWithPrimaryKey.ExecuteCommandLog(connection, FuzzyTripleCreate); SqlTableWithPrimaryKey.ExecuteCommandLog(connection, FuzzyPhraseToDocument); } } }
public AmlRepository(IServiceServer server) : base(server) { _sqlTableWithPrimaryKey = new SqlTableWithPrimaryKey(); connectionString = _sqlTableWithPrimaryKey.GetConnectionString( (string)server.GetConfigProperty("DataDirectory", server.BucketId), server.BucketId, "AmlWorker"); L.Trace($"Initializing Sql - connectionString is {connectionString}"); using (var connection = _sqlTableWithPrimaryKey.NewConnection(connectionString)) { if (!_sqlTableWithPrimaryKey.TableExists(connection, partySql)) { _sqlTableWithPrimaryKey.CreateTable(connection, partySql); } if (!_sqlTableWithPrimaryKey.TableExists(connection, accountSql)) { _sqlTableWithPrimaryKey.CreateTable(connection, accountSql); } if (!_sqlTableWithPrimaryKey.TableExists(connection, "AccountParty")) { new SqlTableSimpleLinkages().CreateManyToManyLinkagesTableWithForeignKeyConstraint(connection, "AccountParty", "AccountId", "PartyId", "Accounts", "Id"); } if (!_sqlTableWithPrimaryKey.TableExists(connection, "PartyAccount")) { new SqlTableSimpleLinkages().CreateManyToManyLinkagesTable(connection, "PartyAccount", "PartyId", "AccountId"); } if (!_sqlTableWithPrimaryKey.TableExists(connection, transactionSql)) { _sqlTableWithPrimaryKey.CreateTable(connection, transactionSql); } } }
public A4ARepositoryGraphDb(SqliteConnection conn, SqlTableWithPrimaryKey messageSql) : base(conn, typeof(A4AQuery)) { this.messageSql = messageSql; }