public SyncDigestTable(IResourceKindTable resourceKindTable, IEndPointTable EndPointTable) { this.ResourceKindTable = resourceKindTable; this.EndPointTable = EndPointTable; string tableName; string[] sqlQueries = new string[4]; tableName = string.Format("{0}tblSyncDigest", Settings.Default.TablePrefix); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([tick] INTEGER NOT NULL, "; sqlQueries[0] += " [ConflictPriority] INTEGER NOT NULL, "; sqlQueries[0] += " [Stamp] TIMESTAMP NOT NULL, "; sqlQueries[0] += " [FKEndPointId] INTEGER NOT NULL, "; sqlQueries[0] += " [FKResourceKindId] INTEGER NOT NULL);"; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK_ID ON [{0}] ([FKEndPointId],[FKResourceKindId]) WITH PRIMARY;", tableName); sqlQueries[2] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKEndPointId FOREIGN KEY (FKEndPointId) REFERENCES {1} (ID)", tableName, EndPointTable.TableName); sqlQueries[3] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKResourceKindId FOREIGN KEY (FKResourceKindId) REFERENCES {1} (ID)", tableName, resourceKindTable.TableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }
public CorrelatedResSyncTable(int resourceKindId, IResourceKindTable resourceKindTable, IEndPointTable EndPointTable) { this.ResourceKindId = resourceKindId; this.ResourceKindTable = resourceKindTable; this.EndPointTable = EndPointTable; string tableName; string[] sqlQueries = new string[4]; tableName = string.Format("{0}tblCorrelatedResSync{1}", Settings.Default.TablePrefix, resourceKindId); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([Uuid] TEXT(38) NOT NULL, "; sqlQueries[0] += " [tick] INTEGER NOT NULL, "; sqlQueries[0] += " [ModifiedStamp] TIMESTAMP NOT NULL, "; sqlQueries[0] += " [Etag] TEXT(255) NOT NULL, "; sqlQueries[0] += " [LocalId] TEXT(40) NOT NULL, "; sqlQueries[0] += " [FKEndPointId] INTEGER NOT NULL, "; sqlQueries[0] += " [FKResourceKindId] INTEGER NOT NULL); "; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK ON [{0}] ([Uuid], [LocalId]) WITH PRIMARY;", tableName); sqlQueries[2] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKEndPointId FOREIGN KEY (FKEndPointId) REFERENCES {1} (ID)", tableName, EndPointTable.TableName); sqlQueries[3] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKResourceKindId FOREIGN KEY (FKResourceKindId) REFERENCES {1} (ID)", tableName, resourceKindTable.TableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }
public EndPointTableAdapter(IEndPointTable EndPointTable, SdataContext context) { _EndPointTable = EndPointTable; this.Context = context; }