Esempio n. 1
0
        private static bool IsScaffoldColumn(CodeProperty propertyType)
        {
            bool        flag;
            IEnumerator enumerator = propertyType.Attributes.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    CodeAttribute current = (CodeAttribute)enumerator.Current;
                    if (!string.Equals(current.FullName, TypeNames.ScaffoldColumnAttributeTypeName, StringComparison.Ordinal))
                    {
                        continue;
                    }
                    flag = CodeModelPropertyMetadata.IsPropertyValuePresent(current, string.Empty, "true");
                    return(flag);
                }
                return(true);
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            return(flag);
        }
Esempio n. 2
0
        private static bool IsPropertyPrimaryKey(CodeProperty propertyType)
        {
            bool flag;

            if (string.Equals(propertyType.Name, "id", StringComparison.OrdinalIgnoreCase))
            {
                return(true);
            }
            if (string.Equals(propertyType.Name, string.Concat(propertyType.Parent.Name, "id"), StringComparison.OrdinalIgnoreCase))
            {
                return(true);
            }
            IEnumerator enumerator = propertyType.Attributes.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    CodeAttribute current = (CodeAttribute)enumerator.Current;
                    if (string.Equals(current.FullName, TypeNames.KeyAttributeTypeName, StringComparison.Ordinal))
                    {
                        flag = true;
                        return(flag);
                    }
                    else if (!string.Equals(current.FullName, TypeNames.EdmScalarPropertyAttributeTypeName, StringComparison.Ordinal) || !CodeModelPropertyMetadata.IsPropertyValuePresent(current, "EntityKeyProperty", "true"))
                    {
                        if (!string.Equals(current.FullName, TypeNames.ColumnAttributeTypeName, StringComparison.Ordinal) || !CodeModelPropertyMetadata.IsPropertyValuePresent(current, "IsPrimaryKey", "true"))
                        {
                            continue;
                        }
                        flag = true;
                        return(flag);
                    }
                    else
                    {
                        flag = true;
                        return(flag);
                    }
                }
                return(false);
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            return(flag);
        }