/// <summary> /// Initializes a new instance of the <see cref="ColumnPropertyDescriptor"/> class. /// </summary> /// <param name="property">The property information.</param> private ColumnPropertyDescriptor(PropertyDecoration property) { this.PropertyDecoration = property; this.PropertyInfo = property.PropertyInfo; this.PropertyType = this.PropertyInfo.PropertyType; this.NotNullablePropertyType = Nullable.GetUnderlyingType(this.PropertyType) ?? this.PropertyType; }
/// <summary> /// Initializes a new instance of the <see cref="ParameterPropertyDescriptor"/> class. /// </summary> /// <param name="property">The property information.</param> internal ParameterPropertyDescriptor(PropertyDecoration property) { this.PropertyDecoration = property; this.PropertyInfo = property.PropertyInfo; this.Type = this.PropertyInfo.PropertyType; this.NotNullableType = Nullable.GetUnderlyingType(this.Type) ?? this.Type; }
/// <summary> /// Creates a new instance of <see cref="ColumnPropertyDescriptor"/> from a <see cref="PropertyDecoration"/> instance. /// </summary> /// <remarks> /// If the property is not decorated with the <see cref="ColumnAttribute"/> the method will return <c>null</c>. /// </remarks> /// <param name="property">The property info to use.</param> /// <returns>A column property descriptor or null otherwise.</returns> internal static IColumnPropertyDescriptor Create(PropertyDecoration property) { if (property == null) { throw new ArgumentNullException(nameof(property), "The property collection can not be null."); } var descriptor = new ColumnPropertyDescriptor(property); return(descriptor.Initialize() ? descriptor : null); }
/// <summary> /// Initializes a new instance of the <see cref="NavigationPropertyDescriptor"/> class. /// </summary> /// <param name="fromDescriptor">From descriptor.</param> /// <param name="property">The property information.</param> private NavigationPropertyDescriptor(ITableTypeDescriptor fromDescriptor, PropertyDecoration property) { this.PropertyDecoration = property; this.FromDescriptor = fromDescriptor; this.PropertyInfo = property.PropertyInfo; }
/// <summary> /// Creates a new instance of <see cref="NavigationPropertyDescriptor"/> from a <see cref="PropertyDecoration"/> instance and a <see cref="TableTypeDescriptor"/>. /// </summary> /// <remarks> /// If the property is not decorated with the <see cref="NavigationAttribute"/> the method will return <c>null</c>. /// </remarks> /// <param name="fromDescriptor">The table type descriptor of the source property.</param> /// <param name="property">The property info to use.</param> /// <returns>A column property descriptor or null otherwise.</returns> internal static INavigationPropertyDescriptor Create(ITableTypeDescriptor fromDescriptor, PropertyDecoration property) { var descriptor = new NavigationPropertyDescriptor(fromDescriptor, property); return(descriptor.Initialize() ? descriptor : null); }