public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { if (databaseContext == null) { throw new ArgumentNullException(nameof(databaseContext)); } if (StringContext == null) { throw new Exception($"The provided {nameof(StringContext)} is null"); } ITableModel table = databaseContext.Table; if (table == null) { throw new Exception($"The {nameof(TableModel)} is not set"); } string TrimedStringContext = TrimContextFromContextWrapper(StringContext); var autoGeneratedValueColumns = table.Columns.Where(m => m.IsAutoGeneratedValue).ToList(); var result = string.Join(string.Empty, autoGeneratedValueColumns.Select(currentColumn => TemplateHandler.HandleTemplate(TrimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, currentColumn)))); return(result); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { ControlContext(StringContext, databaseContext); ITableModel table = databaseContext.Table; if (table == null) { throw new Exception($"The {nameof(table)} is not set"); } if (table.Columns == null) { throw new Exception($"The {nameof(table.Columns)} are not set in {nameof(table)}"); } if (table.Columns.Any(m => m == null)) { throw new Exception($"There is a null reference in the {nameof(table.Columns)} from {nameof(table)}"); } string TrimedStringContext = TrimContextFromContextWrapper(StringContext); var indexedColumns = table.Columns.Where(m => m.IsIndexed); var eachIndexedcolumnResult = indexedColumns .Select(currentColumn => TemplateHandler.HandleTemplate(TrimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, currentColumn))); var result = string.Join(string.Empty, eachIndexedcolumnResult); return(result); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { ControlContext(StringContext, databaseContext); var visitedTablesStack = new List <List <ITableModel> >(); var currentVisitedTables = new List <ITableModel>() { databaseContext.Table }; while (currentVisitedTables.Any()) { visitedTablesStack = visitedTablesStack.Append(currentVisitedTables).ToList(); var extractionResults = ExtractForeignTables(databaseContext.Database, currentVisitedTables); currentVisitedTables = extractionResults.SelectMany(m => m.Item2).Reverse().ToList(); } var tableAndDepth = visitedTablesStack.SelectMany( (currentList, depth) => currentList.Select(current => Tuple.Create(current, depth))).Skip(1).Reverse().ToList(); string trimedStringContext = TrimContextFromContextWrapper(StringContext); var result = string.Join(string.Empty, tableAndDepth.Select(tableAndDepth => TemplateHandler.HandleTemplate(trimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, tableAndDepth.Item1)))); return(result); }
public override string HandleTrimedContext(string StringTrimedContext, IDatabaseContext databaseContext) { if (StringTrimedContext == null) { return(null); } return(TemplateHandler.HandleTemplate(StringTrimedContext, databaseContext)); }
public override string HandleTrimedContext(string StringTrimedContext, IDatabaseContext databaseContext) { if (StringTrimedContext == null) { return(null); } IForeignKeyConstraintModel constraint = databaseContext.ForeignKeyConstraint; if (constraint == null) { return(StringTrimedContext); //TODO Strange } return(TemplateHandler.HandleTemplate(StringTrimedContext, databaseContext)); }
public override string HandleTrimedContext(string StringTrimedContext, IDatabaseContext databaseContext) { if (StringTrimedContext == null) { return(null); } IColumnModel columnModel = databaseContext.Column; if (columnModel == null) { return(StringTrimedContext); } return(TemplateHandler. HandleTemplate(StringTrimedContext, databaseContext)); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { ControlContext(StringContext, databaseContext); ITableModel table = databaseContext.Table; string trimedStringContext = TrimContextFromContextWrapper(StringContext); var constraints = table.ForeignKeyConstraints; if (constraints == null) { throw new ArgumentNullException(nameof(table.ForeignKeyConstraints)); } var result = string.Join(string.Empty, constraints.Select(constraint => TemplateHandler.HandleTemplate(trimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, constraint)))); return(result); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { ControlContext(StringContext, databaseContext); ITableModel table = databaseContext.Table; string TrimedStringContext = TrimContextFromContextWrapper(StringContext); var columns = table.Columns; if (columns == null) { throw new ArgumentException($"{table.Columns} are not set for {nameof(table)}"); } var notAutoGeneratedColumn = columns.Where(currentColumn => currentColumn.IsNotNull).ToList(); var result = string.Join(string.Empty, notAutoGeneratedColumn.Select(currentColumn => TemplateHandler.HandleTemplate(TrimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, currentColumn)))); return(result); }
public override string HandleTrimedContext(string StringTrimedContext, IDatabaseContext databaseContext) { if (StringTrimedContext == null) { return(null); } if (databaseContext == null) { throw new ArgumentNullException(nameof(databaseContext)); } ITableModel table = databaseContext.Table; if (table == null) { return(StringTrimedContext); } return(TemplateHandler. HandleTemplate(StringTrimedContext, databaseContext)); }
public override string ProcessContext(string StringContext, IDatabaseContext databaseContext) { ControlContext(StringContext, databaseContext); IDatabaseModel descriptionPojo = databaseContext.Database; string TrimedStringContext = TrimContextFromContextWrapper(StringContext); string result = string.Join(string.Empty, descriptionPojo.Tables.Select(currentTable => TemplateHandler.HandleTemplate(TrimedStringContext, DatabaseContextCopier.CopyWithOverride(databaseContext, currentTable)))); return(result); }