Пример #1
0
        private void EnsureWriteNode(Plan plan, Schema.Representation representation)
        {
            if (representation.WriteNode == null)
            {
                if (representation.Properties.Count > 1)
                {
                    throw new SchemaException(SchemaException.Codes.InvalidConversionRepresentation, representation.Name, representation.ScalarType.Name);
                }

                plan.Symbols.Push(new Symbol("AValue", representation.ScalarType));
                try
                {
                    plan.Symbols.Push(new Symbol("ANewValue", representation.Properties[0].DataType));
                    try
                    {
                        representation.WriteNode = Compiler.Compile(plan, new AssignmentStatement(new QualifierExpression(new IdentifierExpression("AValue"), new IdentifierExpression(representation.Properties[0].Name)), new IdentifierExpression("ANewValue"))).Nodes[1];
                    }
                    finally
                    {
                        plan.Symbols.Pop();
                    }
                }
                finally
                {
                    plan.Symbols.Pop();
                }
            }
        }
Пример #2
0
        public object GetAsNative(Schema.Representation representation, object tempValue)
        {
            EnsureReadNode(_plan, representation);
            Program program = _serverProcess.ExecutingProgram;

            program.Stack.Push(tempValue);
            try
            {
                return(representation.ReadNode.Execute(program));
            }
            finally
            {
                program.Stack.Pop();
            }
        }
Пример #3
0
        public IDataValue GetAsDataValue(Schema.Representation representation, object tempValue)
        {
            EnsureReadNode(_plan, representation);
            Program program = _serverProcess.ExecutingProgram;

            program.Stack.Push(tempValue);
            try
            {
                return(DataValue.FromNative(this, representation.ScalarType, representation.ReadNode.Execute(program)));
            }
            finally
            {
                program.Stack.Pop();
            }
        }