本文整理汇总了C#中Row.GetFieldValue方法的典型用法代码示例。如果您正苦于以下问题:C# Row.GetFieldValue方法的具体用法?C# Row.GetFieldValue怎么用?C# Row.GetFieldValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row.GetFieldValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RowToRecordInitJSON
/// <summary>
/// Generates JSON object suitable for passing into WV.RecordModel.Record(...) constructor on the client.
/// Pass target to select attributes targeted to ANY target or to the specified one, for example
/// may get attributes for client data entry screen that sees field metadata differently, in which case target will reflect the name
/// of the screen
/// </summary>
public static JSONDataMap RowToRecordInitJSON(Row row, Exception validationError, string recID = null, string target = null, string isoLang = null)
{
var result = new JSONDataMap();
if (row==null) return result;
if (recID.IsNullOrWhiteSpace()) recID = Guid.NewGuid().ToString();
result["OK"] = true;
result["ID"] = recID;
if (isoLang.IsNotNullOrWhiteSpace())
result["ISOLang"] = isoLang;
//20140914 DKh
if (row is FormModel)
{
result[FormModel.JSON_MODE_PROPERTY] = ((FormModel)row).FormMode;
result[FormModel.JSON_CSRF_PROPERTY] = ((FormModel)row).CSRFToken;
}
var fields = new JSONDataArray();
result["fields"] = fields;
var schemaName = row.Schema.Name;
if (row.Schema.TypedRowType!=null) schemaName = row.Schema.TypedRowType.FullName;
foreach(var fdef in row.Schema.FieldDefs.Where(fd=>!fd.NonUI))
{
var fld = new JSONDataMap();
fields.Add(fld);
fld["def"] = fieldDefToJSON(schemaName, fdef, target);
fld["val"] = row.GetFieldValue(fdef);
var ferr = validationError as CRUDFieldValidationException;
//field level exception
if (ferr!= null && ferr.FieldName==fdef.Name)
{
fld["error"] = ferr.ToMessageWithType();
fld["errorText"] = localizeString(schemaName, "errorText", ferr.ClientMessage);
}
}
//record level
if (validationError!=null && !(validationError is CRUDFieldValidationException))
{
result["error"] = validationError.ToMessageWithType();
result["errorText"] = localizeString(schemaName, "errorText", validationError.Message);
}
return result;
}
示例2: GetFieldAsBSON
protected virtual BSONElement GetFieldAsBSON(Row row, Schema.FieldDef field, string targetName)
{
var name = field.GetBackendNameForTarget(targetName);
var fvalue = row.GetFieldValue(field);
var el = ConvertCLRtoBSON(name, fvalue, targetName);
return el;
}
示例3: RowToErlTuple
/// <summary>
/// Converts CLR row data into ErlTuple
/// </summary>
public ErlTuple RowToErlTuple(Row row, bool keysOnly = false)
{
var result = new ErlTuple();
result.Add(new ErlAtom(row.Schema.Name));
var keys = new List<IErlObject>();
foreach(var def in row.Schema)
{
var atr = def[m_Store.TargetName];
if (keysOnly && !atr.Key) break;
if (keys!=null && !atr.Key)
{
if (keys.Count>1)
result.Add( new ErlTuple(keys, false) );
else
foreach(var key in keys) result.Add( key );
keys = null;
}
IErlObject erlValue = ErlAtom.Undefined;
var clrValue = row.GetFieldValue(def);
if (clrValue!=null)
{
Func<object, IErlObject> fconv;
if (!CLR_TO_ERL_TYPEMAP.TryGetValue(atr.BackendType, out fconv))
throw new ErlDataAccessException(StringConsts.ERL_DS_INTERNAL_MAPPING_ERROR+"erltype'{0}' not matched in the dict".Args(atr.BackendType));
erlValue = fconv(clrValue);
}
if (keys!=null)
keys.Add( erlValue );
else
result.Add( erlValue );
}
if (keys!=null)
{
if (keys.Count>1)
result.Add( new ErlTuple(keys, false) );
else
foreach(var key in keys) result.Add( key );
}
return result;
}
示例4: RowToErlTuple
/// <summary>
/// Converts CLR row data into ErlTuple
/// </summary>
public ErlTuple RowToErlTuple(Row row, bool keysOnly = false)
{
var result = new ErlTuple();
result.Add(new ErlAtom(row.Schema.Name));
var keys = new List<IErlObject>();
foreach(var def in row.Schema)
{
var atr = def[m_Store.TargetName];
if (keysOnly && !atr.Key) break;
if (keys!=null && !atr.Key)
{
if (keys.Count>1)
result.Add( new ErlTuple(keys, false) );
else
foreach(var key in keys) result.Add( key );
keys = null;
}
IErlObject erlValue = ErlAtom.Undefined;
var clrValue = row.GetFieldValue(def);
if (clrValue!=null)
erlValue = ClrToErlValue(atr.BackendType, clrValue);
if (keys!=null)
keys.Add( erlValue );
else
result.Add( erlValue );
}
if (keys!=null)
{
if (keys.Count>1)
result.Add( new ErlTuple(keys, false) );
else
foreach(var key in keys) result.Add( key );
}
return result;
}