Ejemplo n.º 1
0
        private static bool IsPropertyForThumbprint(PropertyInfo pi)
        {
            IEnumerable <Attribute> encryptAttributes = pi.GetCustomAttributes(typeof(EncryptAttribute));
            EncryptAttribute        encryptAttribute  = encryptAttributes.FirstOrDefault() as EncryptAttribute;

            if (encryptAttribute != null)
            {
                return(encryptAttribute.IsThumbprint);
            }

            return(false);
        }
Ejemplo n.º 2
0
        private static bool IsPropertyForIntegrity(ISecurEntity securEntity, PropertyInfo pi)
        {
            if (string.Equals(pi.Name, "SecurEntityId", StringComparison.InvariantCultureIgnoreCase))
            {
                return(true);
            }

            if (pi.Name.EndsWith("Id", StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            if (string.Equals(pi.Name, "SecurEntityData", StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            if (string.Equals(pi.Name, "SecurEntityThumbprint", StringComparison.OrdinalIgnoreCase))
            {
                return(true);
            }

            if (string.Equals(pi.Name, GetPrimaryKeyPropertyName(securEntity), StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            if (pi.PropertyType.IsGenericType)
            {
                return(false);
            }

            IEnumerable <Attribute> encryptAttributes = pi.GetCustomAttributes(typeof(EncryptAttribute));
            EncryptAttribute        encryptAttribute  = encryptAttributes.FirstOrDefault() as EncryptAttribute;

            if (encryptAttribute != null)
            {
                Type propertyType = pi.PropertyType;

                if (propertyType == typeof(DateTime) ||
                    propertyType == typeof(string) ||
                    propertyType == typeof(int) ||
                    propertyType == typeof(uint) ||
                    propertyType == typeof(ISecurEntity))
                {
                    return(true);
                }
            }

            return(false);
        }