Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@@ -0,0 +1,69 @@
using System.ComponentModel.DataAnnotations.Resources;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace System.ComponentModel.DataAnnotations.Schema {
/// <summary>
/// Specifies the database column that a property is mapped to.
/// </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 ColumnAttribute : Attribute {
private readonly string _name;
private string _typeName;
private int _order = -1;
/// <summary>
/// Initializes a new instance of the <see cref="ColumnAttribute"/> class.
/// </summary>
public ColumnAttribute() {
}
/// <summary>
/// Initializes a new instance of the <see cref="ColumnAttribute"/> class.
/// </summary>
/// <param name="name">The name of the column the property is mapped to.</param>
public ColumnAttribute(string name) {
if (string.IsNullOrWhiteSpace(name)) {
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, DataAnnotationsResources.ArgumentIsNullOrWhitespace, "name"));
}
_name = name;
}
/// <summary>
/// The name of the column the property is mapped to.
/// </summary>
public string Name {
get { return _name; }
}
/// <summary>
/// The zero-based order of the column the property is mapped to.
/// </summary>
public int Order {
get { return _order; }
set {
if (value < 0) {
throw new ArgumentOutOfRangeException("value");
}
_order = value;
}
}
/// <summary>
/// The database provider specific data type of the column the property is mapped to.
/// </summary>
public string TypeName {
get { return _typeName; }
set {
if (string.IsNullOrWhiteSpace(value)) {
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, DataAnnotationsResources.ArgumentIsNullOrWhitespace, "value"));
}
_typeName = value;
}
}
}
}

View File

@@ -0,0 +1,13 @@
using System.Diagnostics.CodeAnalysis;
namespace System.ComponentModel.DataAnnotations.Schema {
/// <summary>
/// Denotes that the class is a complex type.
/// Complex types are non-scalar properties of entity types that enable scalar properties to be organized within entities.
/// Complex types do not have keys and cannot be managed by the Entity Framework apart from the parent object.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes", Justification = "We want users to be able to extend this class")]
public class ComplexTypeAttribute : Attribute {
}
}

View File

@@ -0,0 +1,27 @@
using System.Diagnostics.CodeAnalysis;
namespace System.ComponentModel.DataAnnotations.Schema {
/// <summary>
/// Specifies how the database generates values for a property.
/// </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 DatabaseGeneratedAttribute : Attribute {
/// <summary>
/// Initializes a new instance of the <see cref="DatabaseGeneratedAttribute"/> class.
/// </summary>
/// <param name="databaseGeneratedOption">The pattern used to generate values for the property in the database.</param>
public DatabaseGeneratedAttribute(DatabaseGeneratedOption databaseGeneratedOption) {
if (!(Enum.IsDefined(typeof(DatabaseGeneratedOption), databaseGeneratedOption))) {
throw new ArgumentOutOfRangeException("databaseGeneratedOption");
}
DatabaseGeneratedOption = databaseGeneratedOption;
}
/// <summary>
/// The pattern used to generate values for the property in the database.
/// </summary>
public DatabaseGeneratedOption DatabaseGeneratedOption { get; private set; }
}
}

View File

@@ -0,0 +1,21 @@
namespace System.ComponentModel.DataAnnotations.Schema {
/// <summary>
/// The pattern used to generate values for a property in the database.
/// </summary>
public enum DatabaseGeneratedOption {
/// <summary>
/// The database does not generate values.
/// </summary>
None,
/// <summary>
/// The database generates a value when a row is inserted.
/// </summary>
Identity,
/// <summary>
/// The database generates a value when a row is inserted or updated.
/// </summary>
Computed
}
}

View File

@@ -0,0 +1,40 @@
using System.ComponentModel.DataAnnotations.Resources;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace System.ComponentModel.DataAnnotations.Schema {
/// <summary>
/// Denotes a property used as a foreign key in a relationship.
/// The annotation may be placed on the foreign key property and specify the associated navigation property name,
/// or placed on a navigation property and specify the associated foreign key name.
/// </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 ForeignKeyAttribute : Attribute {
private readonly string _name;
/// <summary>
/// Initializes a new instance of the <see cref="ForeignKeyAttribute"/> class.
/// </summary>
/// <param name="name">
/// If placed on a foreign key property, the name of the associated navigation property.
/// If placed on a navigation property, the name of the associated foreign key(s).
/// If a navigation property has multiple foreign keys, a comma separated list should be supplied.
/// </param>
public ForeignKeyAttribute(string name) {
if (string.IsNullOrWhiteSpace(name)) {
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, DataAnnotationsResources.ArgumentIsNullOrWhitespace, "name"));
}
_name = name;
}
/// <summary>
/// If placed on a foreign key property, the name of the associated navigation property.
/// If placed on a navigation property, the name of the associated foreign key(s).
/// </summary>
public string Name {
get { return _name; }
}
}
}

View File

@@ -0,0 +1,32 @@
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; }
}
}
}

View File

@@ -0,0 +1,11 @@
using System.Diagnostics.CodeAnalysis;
namespace System.ComponentModel.DataAnnotations.Schema {
/// <summary>
/// Denotes that a property or class should be excluded from database mapping.
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class, AllowMultiple = false)]
[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes", Justification = "We want users to be able to extend this class")]
public class NotMappedAttribute : Attribute {
}
}

View File

@@ -0,0 +1,46 @@
using System.ComponentModel.DataAnnotations.Resources;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace System.ComponentModel.DataAnnotations.Schema {
/// <summary>
/// Specifies the database table that a class is mapped to.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes", Justification = "We want users to be able to extend this class")]
public class TableAttribute : Attribute {
private readonly string _name;
private string _schema;
/// <summary>
/// Initializes a new instance of the <see cref="TableAttribute"/> class.
/// </summary>
/// <param name="name">The name of the table the class is mapped to.</param>
public TableAttribute(string name) {
if (string.IsNullOrWhiteSpace(name)) {
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, DataAnnotationsResources.ArgumentIsNullOrWhitespace, "name"));
}
_name = name;
}
/// <summary>
/// The name of the table the class is mapped to.
/// </summary>
public string Name {
get { return _name; }
}
/// <summary>
/// The schema of the table the class is mapped to.
/// </summary>
public string Schema {
get { return _schema; }
set {
if (string.IsNullOrWhiteSpace(value)) {
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, DataAnnotationsResources.ArgumentIsNullOrWhitespace, "value"));
}
_schema = value;
}
}
}
}