Exemplo n.º 1
0
        public void FixupRelationships()
        {
            var additionalBehaviors              = AdditionalBehaviors.ToDictionary(x => x.Id);
            var entityTypes                      = EntityTypes.ToDictionary(x => x.Id);
            var dataTypes                        = DataTypes.ToDictionary(x => x.Id);
            var entityTypeFacetDefaultValues     = EntityTypeFacetDefaultValues.ToDictionary(x => x.Id);
            var entityTypeFacetDefinitions       = EntityTypeFacetDefinitions.ToDictionary(x => x.Id);
            var entityTypeFacetValues            = EntityTypeFacetValues.ToDictionary(x => x.Id);
            var entityTypeGeneralUsageCategories = EntityTypeGeneralUsageCategories.ToDictionary(x => x.Id);
            var enumTypes                        = EnumTypes.ToDictionary(x => x.Id);
            var enumValues                       = EnumValues.ToDictionary(x => x.Id);
            var expressionDefinitions            = ExpressionDefinitions.ToDictionary(x => x.Id);
            var expressionBodies                 = ExpressionBodies.ToDictionary(x => x.Id);
            var facetTypes                       = FacetTypes.ToDictionary(x => x.Id);
            var properties                       = Properties.ToDictionary(x => x.Id);
            var propertyBehaviors                = PropertyBehaviors.ToDictionary(x => x.Id);
            var propertyFacetDefaultValues       = PropertyFacetDefaultValues.ToDictionary(x => x.Id);
            var propertyFacetDefinitions         = PropertyFacetDefinitions.ToDictionary(x => x.Id);
            var propertyFacetValues              = PropertyFacetValues.ToDictionary(x => x.Id);
            var propertyGeneralUsageCategories   = PropertyGeneralUsageCategories.ToDictionary(x => x.Id);

            Fixup(PropertyFacetValues, properties, nameof(PropertyFacetValue.PropertyId), nameof(PropertyFacetValue.Property), nameof(Property.PropertyFacetValues));
            Fixup(PropertyFacetValues, propertyFacetDefinitions, nameof(PropertyFacetValue.FacetDefinitionId), nameof(PropertyFacetValue.FacetDefinition));

            Fixup(PropertyFacetDefinitions, facetTypes, nameof(PropertyFacetDefinition.FacetTypeId), nameof(PropertyFacetDefinition.FacetType));
            Fixup(PropertyFacetDefinitions, enumTypes, nameof(PropertyFacetDefinition.EnumTypeId), nameof(PropertyFacetDefinition.EnumType));

            Fixup(PropertyFacetDefaultValues, propertyFacetDefinitions, nameof(PropertyFacetDefaultValue.FacetDefinitionId), nameof(PropertyFacetDefaultValue.FacetDefinition));
            Fixup(PropertyFacetDefaultValues, propertyGeneralUsageCategories, nameof(PropertyFacetDefaultValue.GeneralUsageCategoryId), nameof(PropertyFacetDefaultValue.GeneralUsageCategory));

            Fixup(Properties, entityTypes, nameof(Property.OwnerEntityTypeId), nameof(Property.OwnerEntityType), nameof(EntityType.Properties));
            Fixup(Properties, propertyGeneralUsageCategories, nameof(Property.GeneralUsageCategoryId), nameof(Property.GeneralUsageCategory));
            Fixup(Properties, dataTypes, nameof(Property.DataTypeId), nameof(Property.DataType));
            Fixup(Properties, expressionDefinitions, nameof(Property.ExpressionDefinitionId), nameof(Property.ExpressionDefinition));
            Fixup(Properties, entityTypes, nameof(Property.DataEntityTypeId), nameof(Property.DataEntityType));
            Fixup(Properties, properties, nameof(Property.ForeignKeyPropertyId), nameof(Property.ForeignKeyProperty), nameof(Property.Unused1));
            Fixup(Properties, properties, nameof(Property.InversePropertyId), nameof(Property.InverseProperty), nameof(Property.Unused2));

            Fixup(PropertyBehaviors, properties, nameof(PropertyBehavior.PropertyId), nameof(PropertyBehavior.Property), nameof(Property.PropertyBehaviors));
            Fixup(PropertyBehaviors, additionalBehaviors, nameof(PropertyBehavior.AdditionalBehaviorId), nameof(PropertyBehavior.AdditionalBehavior));

            Fixup(ExpressionDefinitions, entityTypes, nameof(ExpressionDefinition.MainInputEntityTypeId), nameof(ExpressionDefinition.MainInputEntityType));
            Fixup(ExpressionDefinitions, expressionBodies, nameof(ExpressionDefinition.ActiveBodyId), nameof(ExpressionDefinition.ActiveBody));

            Fixup(ExpressionBodies, expressionDefinitions, nameof(ExpressionBody.DefinitionId), nameof(ExpressionBody.Definition), nameof(ExpressionDefinition.Bodies));

            Fixup(EnumValues, enumTypes, nameof(EnumValue.EnumTypeId), nameof(EnumValue.EnumType), nameof(EnumType.Values));

            Fixup(EntityTypes, entityTypeGeneralUsageCategories, nameof(EntityType.GeneralUsageCategoryId), nameof(EntityType.GeneralUsageCategory));
            Fixup(EntityTypes, entityTypes, nameof(EntityType.BaseEntityTypeId), nameof(EntityType.BaseEntityType));

            Fixup(EntityTypeFacetValues, entityTypes, nameof(EntityTypeFacetValue.EntityTypeId), nameof(EntityTypeFacetValue.EntityType), nameof(EntityType.FacetValues));
            Fixup(EntityTypeFacetValues, entityTypeFacetDefinitions, nameof(EntityTypeFacetValue.FacetDefinitionId), nameof(EntityTypeFacetValue.FacetDefinition));

            Fixup(EntityTypeFacetDefinitions, facetTypes, nameof(EntityTypeFacetDefinition.FacetTypeId), nameof(EntityTypeFacetDefinition.FacetType));
            Fixup(EntityTypeFacetDefinitions, enumTypes, nameof(EntityTypeFacetDefinition.EnumTypeId), nameof(EntityTypeFacetDefinition.EnumType));

            Fixup(EntityTypeFacetDefaultValues, entityTypeFacetDefinitions, nameof(EntityTypeFacetDefaultValue.FacetDefinitionId), nameof(EntityTypeFacetDefaultValue.FacetDefinition));
            Fixup(EntityTypeFacetDefaultValues, entityTypeGeneralUsageCategories, nameof(EntityTypeFacetDefaultValue.GeneralUsageCategoryId), nameof(EntityTypeFacetDefaultValue.GeneralUsageCategory));
        }
Exemplo n.º 2
0
        internal static IEnumerable <LoaderFacetType> GetFacetTypesImplementing(TypeMoniker type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            return(FacetTypes.Where(x => x.TypeDescriptor.Implements(type)));
        }
Exemplo n.º 3
0
        public static BaseFacetMapper GetFacetMapper(ChromeDriver driver, FacetTypes facetType)
        {
            switch (facetType)
            {
            case FacetTypes.Text:
                return(new TextFacetMapper(driver));

            case FacetTypes.Dropdown:
                return(new DropdownFacetMapper(driver));

            case FacetTypes.CheckBox:
                return(new CheckBoxFacetMapper(driver));

            case FacetTypes.RadioButton:
                return(new RadioButtonFacetMapper(driver));

            case FacetTypes.Aggregation:
                return(new FallbackFacetMapper(driver));

            default:
                throw new ArgumentOutOfRangeException(nameof(facetType), facetType, $"Facet type {facetType} is not supported");
            }
        }
Exemplo n.º 4
0
 protected FacetResult(FacetTypes facetType)
 {
     FacetType = facetType;
 }
Exemplo n.º 5
0
 internal static LoaderFacetType GetFacetInfo(int databaseId)
 {
     return(FacetTypes.Where(x => x.DatabaseId == databaseId).SingleOrDefault());
 }
Exemplo n.º 6
0
 internal static LoaderFacetType GetFacetInfo(TypeMoniker facetType)
 {
     return(FacetTypes.Where(x => x.Type == facetType).Single());
 }
Exemplo n.º 7
0
 internal static IEnumerable <LoaderFacetType> GetFacetTypesForParameterTypes(IEnumerable <TypeDescriptor> parameterTypes)
 {
     return(FacetTypes.Where(ft => parameterTypes.Any(pt => ft.TypeDescriptor.Implements(pt))));
 }