| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Dtf.WindowsInstaller.Linq |
| 4 | { |
| 5 | using System; |
| 6 | |
| 7 | /// <summary> |
| 8 | /// Apply to a subclass of QRecord to indicate the name of |
| 9 | /// the table the record type is to be used with. |
| 10 | /// </summary> |
| 11 | /// <remarks> |
| 12 | /// If this attribute is not used on a record type, the default |
| 13 | /// table name will be derived from the record type name. (An |
| 14 | /// optional underscore suffix is stripped.) |
| 15 | /// </remarks> |
| 16 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] |
| 17 | public class DatabaseTableAttribute : Attribute |
| 18 | { |
| 19 | /// <summary> |
| 20 | /// Creates a new DatabaseTableAttribute for the specified table. |
| 21 | /// </summary> |
| 22 | /// <param name="table">name of the table associated with the record type</param> |
| 23 | public DatabaseTableAttribute(string table) |
| 24 | { |
| 25 | this.Table = table; |
| 26 | } |
| 27 | |
| 28 | /// <summary> |
| 29 | /// Gets or sets the table associated with the record type. |
| 30 | /// </summary> |
| 31 | public string Table { get; set; } |
| 32 | } |
| 33 | |
| 34 | /// <summary> |
| 35 | /// Apply to a property on a subclass of QRecord to indicate |
| 36 | /// the name of the column the property is to be associated with. |
| 37 | /// </summary> |
| 38 | /// <remarks> |
| 39 | /// If this attribute is not used on a property, the default |
| 40 | /// column name will be the same as the property name. |
| 41 | /// </remarks> |
| 42 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] |
| 43 | public class DatabaseColumnAttribute : Attribute |
| 44 | { |
| 45 | /// <summary> |
| 46 | /// Creates a new DatabaseColumnAttribute which maps a |
| 47 | /// record property to a column. |
| 48 | /// </summary> |
| 49 | /// <param name="column">name of the column associated with the property</param> |
| 50 | public DatabaseColumnAttribute(string column) |
| 51 | { |
| 52 | this.Column = column; |
| 53 | } |
| 54 | |
| 55 | /// <summary> |
| 56 | /// Gets or sets the column associated with the record property. |
| 57 | /// </summary> |
| 58 | public string Column { get; set; } |
| 59 | } |
| 60 | } |