public override MapValue[] GetMapValues(ObjectMapper mapper, MemberAccessor member, out bool isSet) { AttributeExtensionCollection extList = mapper.Extension[member.Name]["MapValue"]; if (extList == AttributeExtensionCollection.Null) { return(GetMapValues(mapper.Extension, member.Type, out isSet)); } List <MapValue> list = new List <MapValue>(extList.Count); foreach (AttributeExtension ext in extList) { object origValue = ext["OrigValue"]; if (origValue != null) { origValue = TypeExtension.ChangeType(origValue, member.Type); list.Add(new MapValue(origValue, ext.Value)); } } isSet = true; return(list.ToArray()); }
public override object GetNullValue(MappingSchema mappingSchema, TypeExtension typeExtension, MemberAccessor member, out bool isSet) { // Check extension <Member1 NullValue='-1' /> // var value = GetValue(typeExtension, member, "NullValue", out isSet); return(isSet? TypeExtension.ChangeType(value, member.Type): null); }
public override object GetNullValue(ObjectMapper mapper, MemberAccessor member, out bool isSet) { // Check extension <Member1 NullValue='-1' /> // object value = GetValue(mapper, member, "NullValue", out isSet); return(isSet? TypeExtension.ChangeType(value, member.Type): null); }
public override bool GetNonUpdatableFlag(Type type, TypeExtension typeExt, MemberAccessor member, out bool isSet) { object value = typeExt[member.Name]["NonUpdatable"].Value; if (value != null) { isSet = true; return((bool)TypeExtension.ChangeType(value, typeof(bool))); } return(base.GetNonUpdatableFlag(type, typeExt, member, out isSet)); }
public override int GetPrimaryKeyOrder(Type type, TypeExtension typeExt, MemberAccessor member, out bool isSet) { object value = typeExt[member.Name]["PrimaryKey"].Value; if (value != null) { isSet = true; return((int)TypeExtension.ChangeType(value, typeof(int))); } return(base.GetPrimaryKeyOrder(type, typeExt, member, out isSet)); }
public override object GetDefaultValue(ObjectMapper mapper, MemberAccessor member, out bool isSet) { object value = mapper.Extension[member.Name]["DefaultValue"].Value; if (value != null) { isSet = value != null; return(TypeExtension.ChangeType(value, member.Type)); } return(GetDefaultValue(mapper.Extension, member.Type, out isSet)); }
public override object GetDefaultValue(MappingSchema mappingSchema, TypeExtension typeExtension, MemberAccessor member, out bool isSet) { var value = typeExtension[member.Name]["DefaultValue"].Value; if (value != null) { isSet = true; return(TypeExtension.ChangeType(value, member.Type)); } return(GetDefaultValue(mappingSchema, typeExtension, member.Type, out isSet)); }
public override object GetDefaultValue(TypeExtension typeExt, Type type, out bool isSet) { object value = null; if (type.IsEnum) { value = GetEnumDefaultValueFromExtension(typeExt, type); } if (value == null) { value = typeExt.Attributes["DefaultValue"].Value; } isSet = value != null; return(TypeExtension.ChangeType(value, type)); }
public override NonUpdatableAttribute GetNonUpdatableAttribute(Type type, TypeExtension typeExt, MemberAccessor member, out bool isSet) { object value = typeExt[member.Name]["NonUpdatable"].Value; if (value != null) { isSet = true; return((bool)TypeExtension.ChangeType(value, typeof(bool)) ? new NonUpdatableAttribute() : null); } value = typeExt[member.Name]["Identity"].Value; if (value != null) { isSet = true; return((bool)TypeExtension.ChangeType(value, typeof(bool)) ? new IdentityAttribute() : null); } return(base.GetNonUpdatableAttribute(type, typeExt, member, out isSet)); }
public override object GetDefaultValue(TypeExtension typeExt, Type type, out bool isSet) { object value = null; if (type.IsEnum) { value = GetEnumDefaultValueFromType(type); } if (value == null) { object[] attrs = TypeHelper.GetAttributes(type, typeof(DefaultValueAttribute)); if (attrs != null && attrs.Length != 0) { value = ((DefaultValueAttribute)attrs[0]).Value; } } isSet = value != null; return(TypeExtension.ChangeType(value, type)); }
static List <MapValue> GetTypeMapValues(TypeExtension typeExt, Type type) { AttributeExtensionCollection extList = typeExt.Attributes["MapValue"]; if (extList == AttributeExtensionCollection.Null) { return(null); } List <MapValue> attrs = new List <MapValue>(extList.Count); foreach (AttributeExtension ext in extList) { object origValue = ext["OrigValue"]; if (origValue != null) { origValue = TypeExtension.ChangeType(origValue, type); attrs.Add(new MapValue(origValue, ext.Value)); } } return(attrs); }