Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NavigationPropertyConfiguration"/> class.
        /// </summary>
        /// <param name="property">The backing CLR property.</param>
        /// <param name="multiplicity">The <see cref="EdmMultiplicity"/>.</param>
        /// <param name="declaringType">The declaring structural type.</param>
        public NavigationPropertyConfiguration(PropertyInfo property, EdmMultiplicity multiplicity, StructuralTypeConfiguration declaringType)
            : base(property, declaringType)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            Multiplicity = multiplicity;

            _relatedType = property.PropertyType;
            if (multiplicity == EdmMultiplicity.Many)
            {
                Type elementType;
                if (!TypeHelper.IsCollection(_relatedType, out elementType))
                {
                    throw Error.Argument("property", SRResources.ManyToManyNavigationPropertyMustReturnCollection, property.Name, TypeHelper.GetReflectedType(property).Name);
                }

                _relatedType = elementType;
            }

            OnDeleteAction = EdmOnDeleteAction.None;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="StructuralTypeConfiguration{TStructuralType}"/> class.
 /// </summary>
 /// <param name="configuration">The inner configuration of the structural type.</param>
 protected StructuralTypeConfiguration(StructuralTypeConfiguration configuration)
 {
     Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EnumPropertyConfiguration"/> class.
 /// </summary>
 /// <param name="property">The property of the configuration.</param>
 /// <param name="declaringType">The declaring type of the property.</param>
 public EnumPropertyConfiguration(PropertyInfo property, StructuralTypeConfiguration declaringType)
     : base(property, declaringType)
 {
 }
 internal virtual void DerivesFromNothingImpl()
 {
     _baseType           = null;
     _baseTypeConfigured = true;
 }
 // Returns the base types, this type.
 public static IEnumerable <StructuralTypeConfiguration> ThisAndBaseTypes(
     this StructuralTypeConfiguration structuralType)
 {
     Contract.Assert(structuralType != null);
     return(structuralType.BaseTypes().Concat(new[] { structuralType }));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BindingPathConfiguration{TStructuralType}"/> class.
 /// </summary>
 /// <param name="modelBuilder">The model builder.</param>
 /// <param name="structuralType">The type configuration.</param>
 /// <param name="navigationSource">The navigation source configuration.</param>
 public BindingPathConfiguration(ODataModelBuilder modelBuilder,
                                 StructuralTypeConfiguration <TStructuralType> structuralType,
                                 NavigationSourceConfiguration navigationSource)
     : this(modelBuilder, structuralType, navigationSource, new List <MemberInfo>())
 {
 }