예제 #1
0
        private static Type CreateRelationType(Type entityType, EntityRelationCardinality cardinality)
        {
            switch (cardinality)
            {
            case EntityRelationCardinality.One:
            case EntityRelationCardinality.OptionalOne:
                return(entityType);

            case EntityRelationCardinality.Many:
                return(typeof(ICollection <>).MakeGenericType(entityType));

            default:
                throw new ArgumentOutOfRangeException(nameof(cardinality));
            }
        }
예제 #2
0
            private static EdmMultiplicity Convert(EntityRelationCardinality cardinality)
            {
                switch (cardinality)
                {
                case EntityRelationCardinality.One:
                    return(EdmMultiplicity.One);

                case EntityRelationCardinality.OptionalOne:
                    return(EdmMultiplicity.ZeroOrOne);

                case EntityRelationCardinality.Many:
                    return(EdmMultiplicity.Many);

                default:
                    throw new ArgumentOutOfRangeException(nameof(cardinality));
                }
            }
 public EntityRelationCardinalityFeature(EntityRelationCardinality cardinality, EntityElement target)
 {
     Cardinality = cardinality;
     Target      = target;
 }
예제 #4
0
 private static EdmMultiplicity Convert(EntityRelationCardinality cardinality)
 {
     switch (cardinality)
     {
         case EntityRelationCardinality.One:
             return EdmMultiplicity.One;
         case EntityRelationCardinality.OptionalOne:
             return EdmMultiplicity.ZeroOrOne;
         case EntityRelationCardinality.Many:
             return EdmMultiplicity.Many;
         default:
             throw new ArgumentOutOfRangeException("cardinality");
     }
 }
 public EntityRelationCardinalityFeature(EntityRelationCardinality cardinality, EntityElement target)
 {
     Cardinality = cardinality;
     Target = target;
 }
예제 #6
0
 private static Type CreateRelationType(Type entityType, EntityRelationCardinality cardinality)
 {
     switch (cardinality)
     {
         case EntityRelationCardinality.One:
         case EntityRelationCardinality.OptionalOne:
             return entityType;
         case EntityRelationCardinality.Many:
             return typeof(ICollection<>).MakeGenericType(entityType);
         default:
             throw new ArgumentOutOfRangeException(nameof(cardinality));
     }
 }