Example #1
0
        public static IEdmStructuralProperty AssertHasCollectionProperty(this IEdmStructuredType edmType, IEdmModel model, string propertyName, Type propertyType, bool isNullable)
        {
            IEdmStructuralProperty complexProperty = edmType.AssertHasProperty <IEdmStructuralProperty>(model, propertyName, propertyType, isNullable, isCollection: true);

            Assert.True(complexProperty.Type.IsCollection());
            return(complexProperty);
        }
Example #2
0
        public static IEdmNavigationProperty AssertHasNavigationProperty(this IEdmStructuredType edmType, IEdmModel model, string propertyName, Type mappedPropertyClrType, bool isNullable, EdmMultiplicity multiplicity)
        {
            IEdmNavigationProperty navigationProperty = edmType.AssertHasProperty <IEdmNavigationProperty>(model, propertyName, propertyType: null, isNullable: isNullable);

            Assert.Equal(multiplicity, navigationProperty.TargetMultiplicity());

            Assert.True(navigationProperty.ToEntityType().IsEquivalentTo(model.GetEdmType(mappedPropertyClrType)));
            return(navigationProperty);
        }
Example #3
0
        public static IEdmNavigationProperty AssertHasNavigationProperty(this IEdmStructuredType edmType, IEdmModel model, string propertyName, Type mappedPropertyClrType, bool isNullable, EdmMultiplicity multiplicity)
        {
            IEdmNavigationProperty navigationProperty = edmType.AssertHasProperty <IEdmNavigationProperty>(model, propertyName, propertyType: null, isNullable: isNullable);

            // Bug 468693: in EdmLib. remove when fixed.
            if (multiplicity != EdmMultiplicity.Many)
            {
                Assert.Equal(multiplicity, navigationProperty.Multiplicity());
            }

            Assert.True(navigationProperty.ToEntityType().IsEquivalentTo(model.GetEdmType(mappedPropertyClrType)));
            return(navigationProperty);
        }
Example #4
0
        public static IEdmStructuralProperty AssertHasPrimitiveProperty(this IEdmStructuredType edmType, IEdmModel model, string propertyName, EdmPrimitiveTypeKind primitiveTypeKind, bool isNullable)
        {
            Type primitiveType = EdmLibHelpers.GetClrType(new EdmPrimitiveTypeReference(EdmCoreModel.Instance.GetPrimitiveType(primitiveTypeKind), isNullable), model);

            return(edmType.AssertHasProperty <IEdmStructuralProperty>(model, propertyName, primitiveType, isNullable));
        }
 public static IEdmStructuralProperty AssertHasPrimitiveProperty(this IEdmStructuredType edmType, IEdmModel model, string propertyName, EdmPrimitiveTypeKind primitiveTypeKind, bool isNullable)
 {
     return(edmType.AssertHasProperty <IEdmStructuralProperty>(model, propertyName, EdmCoreModel.Instance.GetPrimitiveType(primitiveTypeKind).FullName(), isNullable));
 }