public async void Invoke() { var managedClassPropertyAndTypeMap = Model.GetAllManagedClasses(); var tables = new Sync.TableBuilder(Model).Build(); var maxVersionNumber = Model.VersionHead; foreach (var managedClassEntry in managedClassPropertyAndTypeMap) { var dictionarywithData = managedClassEntry.Key.GetValue(Model); var activeTable = tables.First(x => x.Name == managedClassEntry.Value.Name); var data = managedClassEntry.Key.PropertyType.GetProperty("Values").GetValue(dictionarywithData) as IEnumerable <ManagedObjectBase>; var classMeta = new ManagedMetaObjectFactory().CreateMetaObject(managedClassEntry.Value); var task = new SQL.SqlLoadData() { Database = Config.DataBase, UserID = Config.DataBaseUserId, Password = Config.DataBaseUserPassword, Port = Config.Port, Server = Config.Server, DataSet = data.ToList(), MetaObjectDescriptor = classMeta, TableDescription = activeTable, ModelContainer = Model, DataStore = dictionarywithData }; var readVersionHead = await task.Run(); maxVersionNumber = Math.Max(maxVersionNumber, readVersionHead); } ReLoadReferences(Model, managedClassPropertyAndTypeMap, tables); Model.VersionHead = Math.Max(Model.VersionHead, maxVersionNumber); }
public async void Invoke() { var managedClassesDescription = Model.GetAllManagedClasses(); var tables = new Sync.TableBuilder(Model).Build(); foreach (var classEntry in managedClassesDescription) { var dictionarywithData = classEntry.Key.GetValue(Model); var activeTable = tables.First(x => x.Name == classEntry.Value.Name); var data = classEntry.Key.PropertyType.GetProperty("Values").GetValue(dictionarywithData) as IEnumerable <ManagedObjectBase>; var metaModel = new ManagedMetaObjectFactory().CreateMetaObject(classEntry.Value); var task = new SQL.SqlPushData() { Database = Config.DataBase, UserID = Config.DataBaseUserId, Password = Config.DataBaseUserPassword, Port = Config.Port, Server = Config.Server, DataSet = data.ToList(), MetaObjectDescriptor = metaModel, TableDescription = activeTable, ModelContainer = Model }; await task.Run(); } }