public void SetCurrentVersions(IList <SyncVersion> tableVersions) { foreach (var tableVersion in tableVersions) { if (TablesToSync.ContainsKey(tableVersion.TableName)) { TablesToSync[tableVersion.TableName] = tableVersion.Version; } else { throw new Exception($"There is no such table {tableVersion.TableName} registered for sync"); } } }
private void RegisterType(Type type) { if (!type.IsSubclassOf(typeof(SyncModel))) { throw new Exception("Sync model class should be inherited from SyncModel"); } if (type.IsDefined(typeof(SisMinVersionAttribute), true)) { var attr = (SisMinVersionAttribute)Attribute.GetCustomAttribute(type, typeof(SisMinVersionAttribute)); if (!VersionHelper.IsSupportedApiVersion(attr.MinVersion, _apiVersion)) { return; } } TablesToSync.Add(type.Name, null); Types.Add(type.Name, type); }