#region License
// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
// This source code is made available under the terms of the GNU Lesser General Public License v3.0
// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
#endregion
using System.Diagnostics;
namespace MiniSqlQuery.Core.DbModel
{
/// The db model column.
[DebuggerDisplay("DbModelColumn: {Name} (DbModelType.Summary: {DbModelType.Summary}, Nullable: {Nullable}, IsKey: {IsKey})")]
public class DbModelColumn : DbModelObjectBase
{
/// Initializes a new instance of the class.
public DbModelColumn()
{
Nullable = true;
DbType = new DbModelType("varchar", 50);
ObjectType = ObjectTypes.Column;
}
/// Gets or sets DbType.
/// The db type.
public virtual DbModelType DbType { get; set; }
/// Gets or sets ForeignKeyReference.
/// The foreign key reference.
public virtual DbModelForeignKeyReference ForeignKeyReference { get; set; }
/// Gets FullName.
/// The full name.
public override string FullName
{
get { return Name; }
}
/// Gets a value indicating whether HasFK.
/// The has fk.
public virtual bool HasFK
{
get { return ForeignKeyReference != null; }
}
/// Gets or sets a value indicating whether IsAutoIncrement.
/// The is auto increment.
public virtual bool IsAutoIncrement { get; set; }
/// Gets or sets a value indicating whether IsIdentity.
/// The is identity.
public virtual bool IsIdentity { get; set; }
/// Gets or sets a value indicating whether IsKey.
/// The is key.
public virtual bool IsKey { get; set; }
/// Gets or sets a value indicating whether IsReadOnly.
/// The is read only.
public virtual bool IsReadOnly { get; set; }
///
/// Gets or sets a value indicating whether this column is a concurrency field, such as a timestamp.
///
///
/// true if this instance is row version, or concurrency field; otherwise, false.
///
public virtual bool IsRowVersion { get; set; }
/// Gets or sets a value indicating whether IsUnique.
/// The is unique.
public virtual bool IsUnique { get; set; }
/// Gets a value indicating whether IsWritable.
/// The is writable.
public virtual bool IsWritable
{
get { return !IsReadOnly; }
}
/// Gets or sets a value indicating whether Nullable.
/// The nullable.
public virtual bool Nullable { get; set; }
/// Gets the parent table of the column.
/// The parent table instance.
public virtual DbModelTable ParentTable { get; internal set; }
}
}