Beispiel #1
0
        private bool MustGenerate(EntityType entityType, TypeProperty property)
        {
            switch (entityType)
            {
            case EntityType.User:
                switch (property.IdentityPropertyType)
                {
                case PropertyType.UserRoles:
                    return(checkBoxRole.Checked);

                case PropertyType.UserClaims:
                    return(checkBoxClaims.Checked);

                case PropertyType.UserLogins:
                    return(checkBoxExternalLogins.Checked);
                }
                break;

            case EntityType.Role:
                switch (property.IdentityPropertyType)
                {
                case PropertyType.RoleClaims:
                    return(checkBoxRoleClaim.Checked);
                }
                break;
            }

            return(true);
        }
Beispiel #2
0
        private Property GetOrCreateProperty(Entity entity, TypeProperty typeProperty)
        {
            Property property = entity.Properties.Find(typeProperty.CanonicalName, StringComparison.OrdinalIgnoreCase);

            if (property == null)
            {
                property = ProjectUtilities.FindByPropertyType(entity, typeProperty.IdentityPropertyType);
                if (property != null)
                {
                    property.Name = typeProperty.CanonicalName;
                }
            }

            if (property == null)
            {
                property          = new Property();
                property.Name     = typeProperty.CanonicalName;
                property.TypeName = typeProperty.ExpectedType;
                if (typeProperty.ExpectedUIType != UIType.Unspecified)
                {
                    property.UIType = typeProperty.ExpectedUIType;
                }

                property.IsNullable = typeProperty.Nullable;

                if (!property.IsNullable && (
                        property.ClrFullTypeName == typeof(int).FullName ||
                        property.ClrFullTypeName == typeof(uint).FullName ||
                        property.ClrFullTypeName == typeof(short).FullName ||
                        property.ClrFullTypeName == typeof(ushort).FullName ||
                        property.ClrFullTypeName == typeof(long).FullName ||
                        property.ClrFullTypeName == typeof(ulong).FullName ||
                        property.ClrFullTypeName == typeof(byte).FullName ||
                        property.ClrFullTypeName == typeof(sbyte).FullName ||
                        property.ClrFullTypeName == typeof(float).FullName ||
                        property.ClrFullTypeName == typeof(decimal).FullName ||
                        property.ClrFullTypeName == typeof(double).FullName ||
                        property.ClrFullTypeName == typeof(DateTime).FullName ||
                        property.ClrFullTypeName == typeof(TimeSpan).FullName ||
                        property.ClrFullTypeName == typeof(DateTimeOffset).FullName ||
                        property.ClrFullTypeName == typeof(Guid).FullName ||
                        property.ClrFullTypeName == typeof(bool).FullName))
                {
                    property.MustUsePersistenceDefaultValue = false;
                }

                property.SetAttributeValue("", "propertyType", Constants.NamespaceUri, typeProperty.IdentityPropertyType);
                entity.Properties.Add(property);
            }

            return(property);
        }
        private Property GetOrCreateProperty(Entity entity, TypeProperty typeProperty)
        {
            Property property = entity.Properties.Find(typeProperty.CanonicalName, StringComparison.OrdinalIgnoreCase);
            if (property == null)
            {
                property = ProjectUtilities.FindByPropertyType(entity, typeProperty.IdentityPropertyType);
                if (property != null)
                {
                    property.Name = typeProperty.CanonicalName;
                }
            }

            if (property == null)
            {
                property = new Property();
                property.Name = typeProperty.CanonicalName;
                property.TypeName = typeProperty.ExpectedType;
                if (typeProperty.ExpectedUIType != UIType.Unspecified)
                {
                    property.UIType = typeProperty.ExpectedUIType;
                }

                property.IsNullable = typeProperty.Nullable;

                if (!property.IsNullable && (
                    property.ClrFullTypeName == typeof(int).FullName ||
                    property.ClrFullTypeName == typeof(uint).FullName ||
                    property.ClrFullTypeName == typeof(short).FullName ||
                    property.ClrFullTypeName == typeof(ushort).FullName ||
                    property.ClrFullTypeName == typeof(long).FullName ||
                    property.ClrFullTypeName == typeof(ulong).FullName ||
                    property.ClrFullTypeName == typeof(byte).FullName ||
                    property.ClrFullTypeName == typeof(sbyte).FullName ||
                    property.ClrFullTypeName == typeof(float).FullName ||
                    property.ClrFullTypeName == typeof(decimal).FullName ||
                    property.ClrFullTypeName == typeof(double).FullName ||
                    property.ClrFullTypeName == typeof(DateTime).FullName ||
                    property.ClrFullTypeName == typeof(TimeSpan).FullName ||
                    property.ClrFullTypeName == typeof(DateTimeOffset).FullName ||
                    property.ClrFullTypeName == typeof(Guid).FullName ||
                    property.ClrFullTypeName == typeof(bool).FullName))
                {
                    property.MustUsePersistenceDefaultValue = false;
                }

                property.SetAttributeValue("", "propertyType", Constants.NamespaceUri, typeProperty.IdentityPropertyType);
                entity.Properties.Add(property);
            }

            return property;
        }
        private bool MustGenerate(EntityType entityType, TypeProperty property)
        {
            switch (entityType)
            {
                case EntityType.User:
                    switch (property.IdentityPropertyType)
                    {
                        case PropertyType.UserRoles:
                            return checkBoxRole.Checked;
                        case PropertyType.UserClaims:
                            return checkBoxClaims.Checked;
                        case PropertyType.UserLogins:
                            return checkBoxExternalLogins.Checked;
                    }
                    break;

                case EntityType.Role:
                    switch (property.IdentityPropertyType)
                    {
                        case PropertyType.RoleClaims:
                            return checkBoxRoleClaim.Checked;
                    }
                    break;

            }

            return true;
        }