示例#1
0
 public void Serialize(BinaryWriter output, FastAccessList <object> referenceTracking = null)
 {
     output.Write(Count);
     foreach (var server in this)
     {
         output.Write(server.Key);
         output.Write(server.Value.Count);
         foreach (var database in server.Value)
         {
             output.Write(database.Key);
             output.Write(database.Value.Count);
             foreach (var schema in database.Value)
             {
                 var nbRows = schema.Value.Count;
                 output.Write(schema.Key);
                 output.Write(nbRows);
                 foreach (var table in schema.Value)
                 {
                     if (referenceTracking == null)
                     {
                         table.Serialize(output);
                     }
                     else
                     {
                         var id = referenceTracking.TryAdd(table);
                         output.Write(id);
                     }
                 }
             }
         }
     }
 }
示例#2
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);
                }
            }
        }
示例#3
0
        public void Serialize(BinaryWriter output, FastAccessList <object> referenceTracking)
        {
            output.Write(Variables.Count);
            foreach (var v in Variables)
            {
                var id = referenceTracking.TryAdd(v);
                output.Write(id);
            }

            output.Write(InsertSteps.Count);
            foreach (var step in InsertSteps)
            {
                step.Serialize(output, referenceTracking);
            }

            output.Write(UpdateSteps.Count);
            foreach (var step in UpdateSteps)
            {
                step.Serialize(output);
            }
        }