Ejemplo n.º 1
0
        // <summary>
        // SimplePolymorphicColumnMap
        // </summary>
        internal override ColumnMap Visit(SimplePolymorphicColumnMap columnMap, VarMap replacementVarMap)
        {
            var newDiscriminator = (SimpleColumnMap)columnMap.TypeDiscriminator.Accept(this, replacementVarMap);

            var newTypeChoices = new Dictionary <object, TypedColumnMap>(columnMap.TypeChoices.Comparer);

            foreach (var kv in columnMap.TypeChoices)
            {
                var newMap = (TypedColumnMap)kv.Value.Accept(this, replacementVarMap);
                newTypeChoices[kv.Key] = newMap;
            }
            var newBaseFieldList = VisitList(columnMap.Properties, replacementVarMap);

            return(new SimplePolymorphicColumnMap(columnMap.Type, columnMap.Name, newBaseFieldList, newDiscriminator, newTypeChoices));
        }
Ejemplo n.º 2
0
        internal override ColumnMap Visit(
            SimplePolymorphicColumnMap columnMap,
            VarMap replacementVarMap)
        {
            SimpleColumnMap typeDiscriminator = (SimpleColumnMap)columnMap.TypeDiscriminator.Accept <ColumnMap, VarMap>((ColumnMapVisitorWithResults <ColumnMap, VarMap>) this, replacementVarMap);
            Dictionary <object, TypedColumnMap> typeChoices = new Dictionary <object, TypedColumnMap>(columnMap.TypeChoices.Comparer);

            foreach (KeyValuePair <object, TypedColumnMap> typeChoice in columnMap.TypeChoices)
            {
                TypedColumnMap typedColumnMap = (TypedColumnMap)typeChoice.Value.Accept <ColumnMap, VarMap>((ColumnMapVisitorWithResults <ColumnMap, VarMap>) this, replacementVarMap);
                typeChoices[typeChoice.Key] = typedColumnMap;
            }
            ColumnMap[] baseTypeColumns = this.VisitList <ColumnMap>(columnMap.Properties, replacementVarMap);
            return((ColumnMap) new SimplePolymorphicColumnMap(columnMap.Type, columnMap.Name, baseTypeColumns, typeDiscriminator, typeChoices));
        }
Ejemplo n.º 3
0
 internal override void Visit(SimplePolymorphicColumnMap columnMap, Dump dumper)
 {
     using (new Dump.AutoXml(dumper, "SimplePolymorphic", Dump.ColumnMapDumper.GetAttributes((ColumnMap)columnMap)))
     {
         using (new Dump.AutoXml(dumper, "typeDiscriminator"))
             columnMap.TypeDiscriminator.Accept <Dump>((ColumnMapVisitor <Dump>) this, dumper);
         Dictionary <string, object> attrs = new Dictionary <string, object>();
         foreach (KeyValuePair <object, TypedColumnMap> typeChoice in columnMap.TypeChoices)
         {
             attrs.Clear();
             attrs.Add("DiscriminatorValue", typeChoice.Key);
             using (new Dump.AutoXml(dumper, "choice", attrs))
                 typeChoice.Value.Accept <Dump>((ColumnMapVisitor <Dump>) this, dumper);
         }
         using (new Dump.AutoXml(dumper, "default"))
             this.VisitList <ColumnMap>(columnMap.Properties, dumper);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     PolymorphicColumnMap
 /// </summary>
 internal override void Visit(SimplePolymorphicColumnMap columnMap, Dump dumper)
 {
     using (new AutoXml(dumper, "SimplePolymorphic", GetAttributes(columnMap)))
     {
         using (new AutoXml(dumper, "typeDiscriminator"))
         {
             columnMap.TypeDiscriminator.Accept(this, dumper);
         }
         var attrs = new Dictionary <string, object>();
         foreach (var tc in columnMap.TypeChoices)
         {
             attrs.Clear();
             attrs.Add("DiscriminatorValue", tc.Key);
             using (new AutoXml(dumper, "choice", attrs))
             {
                 tc.Value.Accept(this, dumper);
             }
         }
         using (new AutoXml(dumper, "default"))
         {
             VisitList(columnMap.Properties, dumper);
         }
     }
 }