public static MetaTable MergeTables(MetaTablePropertyAliasList alias, IEnumerable <MetaTable> tables)
        {
            var d = tables.First().description;

            MetaTable output = new MetaTable(d);

            foreach (MetaTable table in tables)
            {
                Dictionary <String, MetaTableProperty> matchedPropertyBySourceName = new Dictionary <string, MetaTableProperty>();

                foreach (var property in table.properties.items)
                {
                    MetaTableProperty matched_property = output.properties.Get(property.PropertyName, alias);

                    if (matched_property == null)
                    {
                        output.properties.Import(property);
                        matched_property = property;
                    }

                    matchedPropertyBySourceName.Add(property.PropertyName, matched_property);
                }

                output.entries.ExpandEntries(output.properties);

                var targetEntries = output.entries.GetEntryDictionary(d.entryIDPropertyName);
                var sourceEntries = table.entries.GetEntryDictionary(d.entryIDPropertyName);

                foreach (var pair in sourceEntries)
                {
                    // targetEntries.entries.CreateEntry()

                    MetaTableEntry entry = null;
                    if (!targetEntries.ContainsKey(pair.Key))
                    {
                        throw new NotImplementedException();
                        //entry = output.CreateEntry()
                        //output.entries.Add(entry);
                    }
                    else
                    {
                        entry = targetEntries[pair.Key];
                    }

                    foreach (var matchedPair in matchedPropertyBySourceName)
                    {
                        var sourceVal = pair.Value.properties[matchedPair.Key];

                        entry.properties[matchedPair.Value.PropertyName] = sourceVal;
                    }
                }
            }

            return(output);
        }
        public MetaTableProperty Get(String propertyName, MetaTablePropertyAliasList alias = null)
        {
            MetaTableProperty output = this.items.FirstOrDefault(x => x.PropertyName.Equals(propertyName, StringComparison.InvariantCultureIgnoreCase));

            if (output == null)
            {
                if (alias != null)
                {
                    MetaTablePropertyAliasEntry alias_entry = alias.Match(propertyName, false);
                    if (alias_entry != null)
                    {
                        foreach (String a in alias_entry.aliasPropertyNames)
                        {
                            output = Get(a, null);
                            if (output != null)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            return(output);
        }
 public static MetaTable MergeTablesByParams(MetaTablePropertyAliasList alias, params MetaTable[] tables)
 {
     return(MergeTables(alias, tables));
 }