Xamarin Public Jenkins (auto-signing) e79aa3c0ed Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
2016-08-03 10:59:49 +00:00

33 lines
1.4 KiB
C#

using System.ComponentModel.DataAnnotations.Resources;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace System.ComponentModel.DataAnnotations.Schema {
/// <summary>
/// Specifies the inverse of a navigation property that represents the other end of the same relationship.
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes", Justification = "We want users to be able to extend this class")]
public class InversePropertyAttribute : Attribute {
private readonly string _property;
/// <summary>
/// Initializes a new instance of the <see cref="InversePropertyAttribute"/> class.
/// </summary>
/// <param name="property">The navigation property representing the other end of the same relationship.</param>
public InversePropertyAttribute(string property) {
if (string.IsNullOrWhiteSpace(property)) {
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, DataAnnotationsResources.ArgumentIsNullOrWhitespace, "property"));
}
_property = property;
}
/// <summary>
/// The navigation property representing the other end of the same relationship.
/// </summary>
public string Property {
get { return _property; }
}
}
}