コード例 #1
0
ファイル: ObjectNodes.cs プロジェクト: laszlo-kiss/Dataphor
        public override object InternalExecute(Program program)
        {
            var instance = Nodes[0].Execute(program);

                        #if NILPROPOGATION
            if (instance == null)
            {
                return(null);
            }
                        #endif
            var value    = Nodes[1].Execute(program);
            var property = instance.GetType().GetProperty(PropertyName);

            ObjectMarshal.SetHostProperty(instance, property, value);

            return(instance);
        }
コード例 #2
0
ファイル: ObjectNodes.cs プロジェクト: laszlo-kiss/Dataphor
        public override object InternalExecute(Program program, object[] arguments)
        {
            var result = Activator.CreateInstance(_classType);
            var row    = arguments[0] as IRow;

            if (row != null)
            {
                for (int i = 0; i < row.DataType.Columns.Count; i++)
                {
                    var property = _classType.GetProperty(row.DataType.Columns[i].Name);
                    if (property == null)
                    {
                        throw new CompilerException(CompilerException.Codes.UnknownPropertyReference, DataType.Name, row.DataType.Columns[i].Name);
                    }

                    ObjectMarshal.SetHostProperty(result, property, row[i]);
                }
            }
            return(result);
        }