本文整理汇总了C#中MemberAccessor类的典型用法代码示例。如果您正苦于以下问题:C# MemberAccessor类的具体用法?C# MemberAccessor怎么用?C# MemberAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemberAccessor类属于命名空间,在下文中一共展示了MemberAccessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValue
private static object GetValue(TypeExtension typeExtension, MemberAccessor member, string elemName, out bool isSet)
{
var value = typeExtension[member.Name][elemName].Value;
isSet = value != null;
return value;
}
示例2: ToDefinition
public ToDefinition(MemberInfo memberInfo)
{
Require.NotNull(memberInfo, "memberInfo");
// We need a getter as well for situations where we are mapping into an existing object and need to merge into
// 'child' members, rather than just creating new instances of them.
Accessor = new MemberAccessor(memberInfo);
}
示例3: GetMapIgnore
public virtual bool GetMapIgnore(TypeExtension typeExtension, MemberAccessor member, out bool isSet)
{
isSet = false;
return
TypeHelper.IsScalar(member.Type) == false;// ||
//(member.MemberInfo is FieldInfo && ((FieldInfo)member.MemberInfo).IsLiteral);
}
示例4: GetValue
private static object GetValue(ObjectMapper mapper, MemberAccessor member, string elemName, out bool isSet)
{
object value = mapper.Extension[member.Name][elemName].Value;
isSet = value != null;
return value;
}
示例5: GetFieldStorage
public override string GetFieldStorage(TypeExtension typeExtension, MemberAccessor member, out bool isSet)
{
var value = GetValue(typeExtension, member, "FieldStorage", out isSet);
if (value != null)
return value.ToString();
return base.GetFieldStorage(typeExtension, member, out isSet);
}
示例6: GetFieldName
public override string GetFieldName(ObjectMapper mapper, MemberAccessor member, out bool isSet)
{
object value = GetValue(mapper, member, "MapField", out isSet);
if (value != null)
return value.ToString();
return base.GetFieldName(mapper, member, out isSet);
}
示例7: GetMapIgnore
public override bool GetMapIgnore(TypeExtension typeExtension, MemberAccessor member, out bool isSet)
{
var value = GetValue(typeExtension, member, "MapIgnore", out isSet);
if (value != null)
return TypeExtension.ToBoolean(value);
return base.GetMapIgnore(typeExtension, member, out isSet) || GetAssociation(typeExtension, member) != null;
}
示例8: GetIgnore
public override bool GetIgnore(ObjectMapper mapper, MemberAccessor member, out bool isSet)
{
object value = GetValue(mapper, member, "MapIgnore", out isSet);
if (value != null)
return TypeExtension.ToBoolean(value);
return base.GetIgnore(mapper, member, out isSet);
}
示例9: GetInheritanceDiscriminator
public override bool GetInheritanceDiscriminator(TypeExtension typeExtension, MemberAccessor member, out bool isSet)
{
var value = GetValue(typeExtension, member, "IsInheritanceDiscriminator", out isSet);
if (value != null)
return TypeExtension.ToBoolean(value);
return base.GetInheritanceDiscriminator(typeExtension, member, out isSet);
}
示例10: MemberAccessorTests
public MemberAccessorTests() {
person = new Person();
person.NameField = "John Smith";
person.Forename = "John";
person.Address = new Address {Country = new Country {Name = "United States"}};
nameFieldAccessor = MemberAccessor<Person>.From(x => x.NameField);
forenameAccessor = MemberAccessor<Person>.From(x => x.Forename);
countryNameAccessor = MemberAccessor<Person>.From(x => x.Address.Country.Name);
}
示例11: GetIgnore
public override bool GetIgnore(ObjectMapper mapper, MemberAccessor member, out bool isSet)
{
if (IsLinqObject(mapper.TypeAccessor.Type))
{
isSet = true;
return member.GetAttribute<ColumnAttribute>() == null;
}
return base.GetIgnore(mapper, member, out isSet);
}
示例12: SetEnumConverterInternal
void SetEnumConverterInternal(MemberAccessor ma, MappingSchema ms)
{
if (_valueConverter == null)
{
_valueConverter = o => ms.MapEnumToValue(o, ma, true);
}
else
{
var converter = _valueConverter;
_valueConverter = o => ms.MapEnumToValue(converter(o), ma, true);
}
}
示例13: GetIgnore
public override bool GetIgnore(ObjectMapper mapper, MemberAccessor member, out bool isSet)
{
foreach (MetadataProviderBase p in _list)
{
bool ignore = p.GetIgnore(mapper, member, out isSet);
if (isSet)
return ignore;
}
return base.GetIgnore(mapper, member, out isSet);
}
示例14: GetFieldName
public override string GetFieldName(ObjectMapper mapper, MemberAccessor member, out bool isSet)
{
foreach (MetadataProviderBase p in _list)
{
string name = p.GetFieldName(mapper, member, out isSet);
if (isSet)
return name;
}
return base.GetFieldName(mapper, member, out isSet);
}
示例15: GetTrimmable
public override bool GetTrimmable(ObjectMapper mapper, MemberAccessor member, out bool isSet)
{
if (member.Type == typeof(string))
{
object value = GetValue(mapper, member, "Trimmable", out isSet);
if (value != null)
return TypeExtension.ToBoolean(value);
}
return base.GetTrimmable(mapper, member, out isSet);
}