ColumnAttribute.DbType Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the type of the database column.

Namespace:   System.Data.Linq.Mapping
Assembly:  System.Data.Linq (in System.Data.Linq.dll)

public string DbType { get; set; }

Property Value

Type: System.String

See Remarks.

Use this property to specify the exact text that defines the column in a Transact-SQL table declaration. Specify the DbType property only if you plan to use CreateDatabase to create an instance of the database.

The default value of DbType is inferred from the member type. For more information, see SQL-CLR Type Mapping.

[Column(Storage="_FirstName", DbType="NVarChar(10) NOT NULL", CanBeNull=false)]
public string FirstName
{
	get
	{
		return this._FirstName;
	}
	set
	{
		if ((this._FirstName != value))
		{
			this.OnFirstNameChanging(value);
			this.SendPropertyChanging();
			this._FirstName = value;
			this.SendPropertyChanged("FirstName");
			this.OnFirstNameChanged();
		}
	}
}

.NET Framework
Available since 3.5
Windows Phone Silverlight
Available since 7.1
Return to top
Show: