Beispiel #1
0
        public void Travel(IReadVisitor visitor, DataBlock graph)
        {
            Guid?v0;

            if (visitor.TryVisitValue(_argsId, out v0) && v0.HasValue)
            {
                graph.Id = v0.Value;
            }

            String v1;

            if (visitor.TryVisitValue(_argsString, out v1))
            {
                graph.String = v1;
            }

            Int16?v2;

            if (visitor.TryVisitValue(_argsInt16, out v2) && v2.HasValue)
            {
                graph.Int16 = v2.Value;
            }

            Int32?v3;

            if (visitor.TryVisitValue(_argsInt32, out v3) && v3.HasValue)
            {
                graph.Int32 = v3.Value;
            }

            Int64?v4;

            if (visitor.TryVisitValue(_argsInt64, out v4) && v4.HasValue)
            {
                graph.Int64 = v4.Value;
            }

            UInt16?v5;

            if (visitor.TryVisitValue(_argsUInt16, out v5) && v5.HasValue)
            {
                graph.UInt16 = v5.Value;
            }

            UInt32?v6;

            if (visitor.TryVisitValue(_argsUInt32, out v6) && v6.HasValue)
            {
                graph.UInt32 = v6.Value;
            }

            UInt64?v7;

            if (visitor.TryVisitValue(_argsUInt64, out v7) && v7.HasValue)
            {
                graph.UInt64 = v7.Value;
            }

            Single?v8;

            if (visitor.TryVisitValue(_argsSingle, out v8) && v8.HasValue)
            {
                graph.Single = v8.Value;
            }

            Double?v9;

            if (visitor.TryVisitValue(_argsDouble, out v9) && v9.HasValue)
            {
                graph.Double = v9.Value;
            }

            TimeSpan?v10;

            if (visitor.TryVisitValue(_argsTimeSpan, out v10) && v10.HasValue)
            {
                graph.TimeSpan = v10.Value;
            }

            Decimal?v11;

            if (visitor.TryVisitValue(_argsDecimal, out v11) && v11.HasValue)
            {
                graph.Decimal = v11.Value;
            }

            DateTime?v12;

            if (visitor.TryVisitValue(_argsDateTime, out v12) && v12.HasValue)
            {
                graph.DateTime = v12.Value;
            }

            Byte?v13;

            if (visitor.TryVisitValue(_argsByte, out v13) && v13.HasValue)
            {
                graph.Byte = v13.Value;
            }

            Boolean?v14;

            if (visitor.TryVisitValue(_argsBoolean, out v14) && v14.HasValue)
            {
                graph.Boolean = v14.Value;
            }

            Byte[] v15;
            if (visitor.TryVisitValue(_argsBlob, out v15))
            {
                graph.Blob = v15;
            }

            ValueState state;

            state = visitor.TryVisit(_argsMessages);
            if (state != ValueState.NotFound)
            {
                if (state == ValueState.Found)
                {
                    var    c = new List <string>();
                    string cv;
                    while (visitor.TryVisitValue(VisitArgs.CollectionItem, out cv) && cv != null)
                    {
                        c.Add(cv);
                    }
                    graph.Messages = c;

                    visitor.Leave(_argsMessages);
                }
                else
                {
                    graph.Messages = null;
                }
            }

            state = visitor.TryVisit(_argsStamps);
            if (state != ValueState.NotFound)
            {
                if (state == ValueState.Found)
                {
                    var      c = new List <DateTime>();
                    DateTime?cv;
                    while (visitor.TryVisitValue(VisitArgs.CollectionItem, out cv) && cv.HasValue)
                    {
                        c.Add(cv.Value);
                    }
                    graph.Stamps = c;

                    visitor.Leave(_argsStamps);
                }
                else
                {
                    graph.Stamps = null;
                }
            }

            state = visitor.TryVisit(_argsRelation);
            if (state != ValueState.NotFound)
            {
                if (state == ValueState.Found)
                {
                    var c = new Relation();
                    _travellerRelation0.Travel(visitor, c);
                    graph.Relation = c;

                    visitor.Leave(_argsRelation);
                }
                else
                {
                    graph.Relation = null;
                }
            }

            state = visitor.TryVisit(_argsDummyRelation);
            if (state != ValueState.NotFound)
            {
                if (state == ValueState.Found)
                {
                    var c = new Relation();
                    _travellerRelation0.Travel(visitor, c);
                    graph.DummyRelation = c;

                    visitor.Leave(_argsDummyRelation);
                }
                else
                {
                    graph.DummyRelation = null;
                }
            }

            state = visitor.TryVisit(_argsSecondaryRelations);
            if (state != ValueState.NotFound)
            {
                if (state == ValueState.Found)
                {
                    var c = new List <Relation>();
                    while (visitor.TryVisit(VisitArgs.CollectionItem) == ValueState.Found)
                    {
                        var cv = new Relation();
                        _travellerRelation0.Travel(visitor, cv);
                        visitor.Leave(VisitArgs.CollectionItem);
                        c.Add(cv);
                    }
                    graph.SecondaryRelations = c;

                    visitor.Leave(_argsSecondaryRelations);
                }
                else
                {
                    graph.SecondaryRelations = null;
                }
            }

            state = visitor.TryVisit(_argsIndexedValues);
            if (state != ValueState.NotFound)
            {
                if (state == ValueState.Found)
                {
                    IDictionary <string, int> c = new Dictionary <string, int>();
                    string ck;
                    while (visitor.TryVisitValue(VisitArgs.DictionaryKey, out ck) && ck != null)
                    {
                        int?cv;
                        if (visitor.TryVisitValue(VisitArgs.DictionaryValue, out cv) && cv.HasValue)
                        {
                            c.Add(ck, cv.Value);
                        }
                        else
                        {
                            throw InvalidGraphException.NoDictionaryValue("IndexedValues");
                        }
                    }
                    graph.IndexedValues = (Dictionary <string, int>)c;

                    visitor.Leave(_argsIndexedValues);
                }
                else
                {
                    graph.IndexedValues = null;
                }
            }

            state = visitor.TryVisit(_argsCategories);
            if (state != ValueState.NotFound)
            {
                if (state == ValueState.Found)
                {
                    IDictionary <Identifier, Category> c = new Dictionary <Identifier, Category>();
                    while (visitor.TryVisit(VisitArgs.DictionaryKey) == ValueState.Found)
                    {
                        var ck = new Identifier();
                        _travellerIdentifier1.Travel(visitor, ck);
                        visitor.Leave(VisitArgs.DictionaryKey);

                        if (visitor.TryVisit(VisitArgs.DictionaryValue) == ValueState.Found)
                        {
                            var cv = new Category();
                            _travellerCategory2.Travel(visitor, cv);
                            visitor.Leave(VisitArgs.DictionaryValue);

                            c.Add(ck, cv);
                        }
                        else
                        {
                            throw InvalidGraphException.NoDictionaryValue("Categories");
                        }
                    }
                    graph.Categories = (Dictionary <Identifier, Category>)c;

                    visitor.Leave(_argsCategories);
                }
                else
                {
                    graph.IndexedValues = null;
                }
            }
        }