Esempio n. 1
0
        public override Association GetAssociation(TypeExtension typeExtension, MemberAccessor member)
        {
            if (typeExtension == TypeExtension.Null)
            {
                return(null);
            }

            MemberExtension mex = typeExtension[member.Name];

            if (mex == MemberExtension.Null)
            {
                return(null);
            }

            AttributeExtensionCollection attrs = mex.Attributes[TypeExtension.NodeName.Association];

            if (attrs == AttributeExtensionCollection.Null)
            {
                return(null);
            }

            return(new Association(
                       member,
                       Association.ParseKeys(attrs[0]["ThisKey", string.Empty].ToString()),
                       Association.ParseKeys(attrs[0]["OtherKey", string.Empty].ToString()),
                       attrs[0]["Storage", string.Empty].ToString(),
                       TypeExtension.ToBoolean(attrs[0]["Storage", "True"], true)));
        }
Esempio n. 2
0
        public override InheritanceMappingAttribute[] GetInheritanceMapping(Type type, TypeExtension typeExtension)
        {
            var extList = typeExtension.Attributes["InheritanceMapping"];

            if (extList == AttributeExtensionCollection.Null)
            {
                return(Array <InheritanceMappingAttribute> .Empty);
            }

            var attrs = new InheritanceMappingAttribute[extList.Count];

            for (var i = 0; i < extList.Count; i++)
            {
                var ext = extList[i];

                attrs[i] = new InheritanceMappingAttribute
                {
                    Code      = ext["Code"],
                    IsDefault = TypeExtension.ToBoolean(ext["IsDefault", "False"], false),
                    Type      = Type.GetType(Convert.ToString(ext["Type"]))
                };
            }

            return(attrs);
        }
        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));
        }
Esempio n. 4
0
        public override bool GetMapIgnore(TypeExtension typeExtension, MemberAccessor member, out bool isSet)
        {
            object 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);
        }
Esempio n. 5
0
        public override bool GetInheritanceDiscriminator(TypeExtension typeExtension, MemberAccessor member, out bool isSet)
        {
            object value = GetValue(typeExtension, member, "IsInheritanceDiscriminator", out isSet);

            if (value != null)
            {
                return(TypeExtension.ToBoolean(value));
            }

            return(base.GetInheritanceDiscriminator(typeExtension, member, out isSet));
        }
Esempio n. 6
0
        public override bool GetSqlIgnore(TypeExtension typeExtension, MemberAccessor member, out bool isSet)
        {
            var value = GetValue(typeExtension, member, "SqlIgnore", out isSet);

            if (value != null)
            {
                return(TypeExtension.ToBoolean(value));
            }

            return(base.GetSqlIgnore(typeExtension, member, out isSet));
        }
        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));
        }
        public override bool GetNullable(ObjectMapper mapper, MemberAccessor member, out bool isSet)
        {
            // Check extension <Member1 Nullable='true' />
            //
            object value = GetValue(mapper, member, "Nullable", out isSet);

            if (isSet)
            {
                return(TypeExtension.ToBoolean(value));
            }

            // Check extension <Member1 NullValue='-1' />
            //
            if (GetValue(mapper, member, "NullValue", out isSet) != null)
            {
                return(true);
            }

            return(base.GetNullable(mapper, member, out isSet));
        }
Esempio n. 9
0
        public override bool GetLazyInstance(MappingSchema mappingSchema, TypeExtension typeExtension, MemberAccessor member, out bool isSet)
        {
            // Check extension <Member1 Nullable='true' />
            //
            var value = GetValue(typeExtension, member, "LazyInstance", out isSet);

            if (isSet)
            {
                return(TypeExtension.ToBoolean(value));
            }

            // Check extension <Member1 NullValue='-1' />
            //
            if (GetValue(typeExtension, member, "LazyInstance", out isSet) != null)
            {
                return(true);
            }

            return(base.GetLazyInstance(mappingSchema, typeExtension, member, out isSet));
        }