示例#1
0
        public void Serialize(BinaryWriter output, FastAccessList <object> referenceTracking)
        {
            var bf = SerializationHelper.DefaultFormatter;

            output.Write(StepId);
            output.Write(Depth);
            SourceTable.Serialize(output);
            DestinationTable.Serialize(output);

            //Variable
            output.Write(Variables.Count);
            foreach (var v in Variables)
            {
                var vId = referenceTracking.TryAdd(v);
                output.Write(vId);
            }

            //TableSchema
            var tsId = referenceTracking.TryAdd(TableSchema);

            output.Write(tsId);

            //Datarow
            output.Write(Datarow.Length);
            for (var i = 0; i < Datarow.Length; i++)
            {
                var data = Datarow[i];
                var type = data.GetType();
                var tag  = SerializationHelper.TypeToTag[type];
                output.Write(tag);

                if (type == typeof(SqlVariable))
                {
                    var svId = referenceTracking.TryAdd(data);
                    output.Write(svId);
                }
                else
                {
                    bf.Serialize(output.BaseStream, data);
                }
            }
        }