本文整理汇总了C#中IErlObject.IsNull方法的典型用法代码示例。如果您正苦于以下问题:C# IErlObject.IsNull方法的具体用法?C# IErlObject.IsNull怎么用?C# IErlObject.IsNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IErlObject
的用法示例。
在下文中一共展示了IErlObject.IsNull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ErlToClrValue
internal static object ErlToClrValue(IErlObject erlValue, Schema schema, Schema.FieldDef fdef, string targetName = null, IErlObject outerTerm = null)
{
if (erlValue.IsNull())
return null;
var atr = fdef[targetName];
var dataType = atr.BackendType;
if (dataType.IsNullOrWhiteSpace())
throw new ErlDataAccessException(StringConsts.ERL_DS_INTERNAL_MAPPING_ERROR +
"fielddef '{0}.{1}' has no backend type".Args(schema.Name, fdef.Name));
Tuple<Type, Func<IErlObject, object>> mapping;
if (ERL_TO_CLR_TYPEMAP.TryGetValue(dataType, out mapping))
{
try
{
return mapping.Item2(erlValue);
}
catch (Exception error)
{
var err = "Schema '{0}' field '{1}' ({2}) cannot be converted from '{3}' to '{4}' format{5}"
.Args(schema.Name, fdef.Name, erlValue.ToString(), erlValue.GetType(), dataType,
outerTerm == null ? "" : " in record:\n {0}".Args(outerTerm.ToString()));
App.Log.Write(new Log.Message
{
Type = Log.MessageType.TraceErl,
Topic = CoreConsts.ERLANG_TOPIC,
From = "SchemaMap.ErlTupleToRow({0})".Args(schema.Name),
Text = err + error.ToMessageWithType(),
Exception = error
});
throw new ErlDataAccessException(err, inner: error);
}
}
var er = StringConsts.ERL_DS_INTERNAL_MAPPING_ERROR +
"erltype'{0}' not matched in the dict".Args(dataType);
throw new ErlDataAccessException(er);
}