Ejemplo n.º 1
0
        public ModelMerge(CommandProvider <TKey> commandProvider, IEnumerable <Type> modelTypes)
        {
            CommandProvider = commandProvider;
            ModelTypes      = modelTypes;
            ModelTables     = modelTypes.Select(t => CommandProvider.GetTableInfo(t));

            var mappedColumns = modelTypes.SelectMany(t => commandProvider.GetMappedColumns(t));

            ModelProperties = mappedColumns.ToLookup(pi => pi.DeclaringType);

            ModelColumns = mappedColumns.Select(pi =>
            {
                var col = new ColumnInfo(pi);
                CommandProvider.MapProviderSpecificInfo(pi, col);
                return(col);
            });
        }