Ejemplo n.º 1
0
        public static DataParams SerializableParamDataToDataParams(Alphora.Dataphor.DAE.IServerProcess process, SerializableParamData paramsValue)
        {
            if ((paramsValue.Params != null) && (paramsValue.Params.Length > 0))
            {
                DataParams     localParamsValue = new DataParams();
                Schema.RowType rowType          = new Schema.RowType();
                for (int index = 0; index < paramsValue.Params.Length; index++)
                {
                    rowType.Columns.Add(new Schema.Column(paramsValue.Params[index].Name, (Schema.ScalarType)process.Session.Server.Catalog[paramsValue.Params[index].TypeName]));
                }

                Data.Row row = new Data.Row(process.ValueManager, rowType);
                try
                {
                    row.ValuesOwned = false;
                    row.AsPhysical  = paramsValue.Data.Data;

                    for (int index = 0; index < paramsValue.Params.Length; index++)
                    {
                        if (row.HasValue(index))
                        {
                            localParamsValue.Add(new DataParam(row.DataType.Columns[index].Name, row.DataType.Columns[index].DataType, SerializableModifierToModifier(paramsValue.Params[index].Modifier), Data.DataValue.CopyValue(process.ValueManager, row[index])));
                        }
                        else
                        {
                            localParamsValue.Add(new DataParam(row.DataType.Columns[index].Name, row.DataType.Columns[index].DataType, SerializableModifierToModifier(paramsValue.Params[index].Modifier), null));
                        }
                    }

                    return(localParamsValue);
                }
                finally
                {
                    row.Dispose();
                }
            }
            else
            {
                return(null);
            }
        }