Ejemplo n.º 1
0
 /// <summary>
 /// Create a new GetTableColumns_Result object.
 /// </summary>
 /// <param name="tableName">Initial value of the TableName property.</param>
 public static GetTableColumns_Result CreateGetTableColumns_Result(global::System.String tableName)
 {
     GetTableColumns_Result getTableColumns_Result = new GetTableColumns_Result();
     getTableColumns_Result.TableName = tableName;
     return getTableColumns_Result;
 }
        private LookupTable DecorateFlatTable(string name, GetTableColumns_Result[] tableColumns, bool includeRows = true)
        {
            var ratingTable = new LookupTable(name)
            {
                Keys =
                    tableColumns.Where(p => p.IsKey != null && p.IsKey == true).Select(
                        p => new FactorTableColumnDefinition(p.ColumnName, true)
                                 {
                                     LookupType = (LookupType)Enum.Parse(typeof(LookupType), p.LookupType, true)
                                 }).ToArray(),
                Columns =
                    tableColumns.Where(p => p.IsKey != null && p.IsKey == false).Select(
                        p => new FactorTableColumnDefinition(p.ColumnName, false)).ToArray()
            };
            if (includeRows)
            {
                var allColumns = ratingTable.Keys.Concat(ratingTable.Columns).ToArray();
                //RatingTablesDb.Connection.Open();

                RatingTableQuery(
                    FlatTableQueries.BuildVersionedQuery(ratingTable.Name, allColumns.Select(p => p.Name).ToArray(), EffectiveDate),
                        reader => ReadLookupTableRows(ratingTable, reader));
            }
            return ratingTable;
        }