예제 #1
0
        public static string Serialize(GraphViewCommand command,
                                       Dictionary <string, IAggregateFunction> sideEffectFunctions,
                                       GraphViewExecutionOperator op)
        {
            string commandString = SerializeWithSoapFormatter(command);

            WrapSideEffectFunctions wrapSideEffectFunctions = new WrapSideEffectFunctions(sideEffectFunctions);
            string sideEffectString = SerializeWithSoapFormatter(wrapSideEffectFunctions);

            string opString = SerializeWithSoapFormatter(op);

            // To combine three string into one string.
            string[] arr = { commandString, sideEffectString, opString };
            return(SerializeWithSoapFormatter(arr));
        }
예제 #2
0
        public static Tuple <GraphViewCommand, GraphViewExecutionOperator> Deserialize(string serializationString)
        {
            string[] arr = (string[])DeserializeWithSoapFormatter(serializationString);

            string           commandString = arr[0];
            GraphViewCommand command       = (GraphViewCommand)DeserializeWithSoapFormatter(commandString);

            // Deserilization of sideEffectFunctions needs information about command.
            string sideEffectString = arr[1];
            AdditionalSerializationInfo additionalInfo          = new AdditionalSerializationInfo(command);
            WrapSideEffectFunctions     wrapSideEffectFunctions =
                (WrapSideEffectFunctions)DeserializeWithSoapFormatter(sideEffectString, additionalInfo);

            // Deserilization of op needs information about command and sideEffectFunctions.
            string opString = arr[2];

            additionalInfo.SideEffectFunctions = wrapSideEffectFunctions.sideEffectFunctions;
            GraphViewExecutionOperator op = (GraphViewExecutionOperator)DeserializeWithSoapFormatter(opString, additionalInfo);

            return(new Tuple <GraphViewCommand, GraphViewExecutionOperator>(command, op));
        }