private void GenerateEntities(ImportTablesEventArgs args, SampleOrmModel ormModel) { using (var transaction = ormModel.Store.TransactionManager.BeginTransaction()) { foreach (var tableDefinition in args.TableDefinitions) { var entityElement = new EntityElement(ormModel.Store, null) { Name = tableDefinition.TableName, TableName = tableDefinition.TableName }; foreach (var columnDefinition in tableDefinition.ColumnDefinitions) { var property = new Property(ormModel.Store, null) { ColumnName = columnDefinition.ColumnName, Name = columnDefinition.ColumnName, Type = TypeCode.String }; entityElement.Properties.Add(property); } ormModel.Elements.Add(entityElement); } transaction.Commit(); } }
private void DeleteEntities(SampleOrmModel ormModel) { using (var transaction = ormModel.Store.TransactionManager.BeginTransaction()) { ormModel.Elements.Clear(); transaction.Commit(); } }