nHydrate.Generator.Models.Table.GetFullHierarchyTableJoin C# (CSharp) Method

GetFullHierarchyTableJoin() public method

public GetFullHierarchyTableJoin ( ) : string
return string
        public string GetFullHierarchyTableJoin()
        {
            return GetFullHierarchyTableJoin(false);
        }

Same methods

Table::GetFullHierarchyTableJoin ( bool useLinqAlias ) : string

Usage Example

            public static string GetBody(Table table, ModelRoot model)
            {
                var sb = new StringBuilder();

                if (table.AllowModifiedAudit)
                {
                    sb.AppendLine("IF (@" + model.Database.ModifiedDateColumnName + " IS NULL)");
                    sb.AppendLine("SET @" + model.Database.ModifiedDateColumnName + " = " + model.GetSQLDefaultDate() + ";");
                    sb.AppendLine();
                }

                sb.AppendLine("SET NOCOUNT ON;");

                if (!table.Immutable)
                {
                    var tableList = table.GetTableHierarchy();
                    foreach (var t in tableList)
                    {
                        //If there is nothing to set then do not do anything
                        var setStatment = BuildSetStatement(t, model);
                        if (!string.IsNullOrEmpty(setStatment))
                        {
                            sb.AppendLine("UPDATE ");
                            sb.AppendLine("\t[" + t.GetSQLSchema() + "].[" + t.DatabaseName + "] ");
                            sb.AppendLine("SET");
                            sb.AppendLine(setStatment);
                            sb.AppendLine("WHERE");
                            sb.AppendLine("\t" + BuildUpdateWhereStatement(t, model, ((table.GetAbsoluteBaseTable() == t) && table.AllowTimestamp)));
                            sb.AppendLine();
                            sb.AppendLine("if (@@RowCount = 0) return;");
                            sb.AppendLine();
                        }
                    }
                }

                sb.AppendLine("SELECT");
                sb.Append(Globals.BuildSelectList(table, model, true));
                sb.AppendLine("FROM ");
                sb.AppendLine(table.GetFullHierarchyTableJoin());
                sb.AppendLine("WHERE");
				sb.AppendLine("\t" + BuildSelectWhereStatement(table, model));
                return sb.ToString();
            }
All Usage Examples Of nHydrate.Generator.Models.Table::GetFullHierarchyTableJoin