use*_*560 9 .net c# entity-framework
如何创建TEXT而不是NVARCHAR的字段?现在我有了
public string Text { get; set; }
Run Code Online (Sandbox Code Playgroud)
但是这总是变成一个nvarchar列,我需要一个Text列
Moh*_*oho 32
您可以使用 System.ComponentModel.DataAnnotations.Schema.ColumnAttribute
[Column(TypeName = "text")]
public string Text { get; set; }
Run Code Online (Sandbox Code Playgroud)
或通过Fluent API:
modelBuilder.Entity<YourEntityTypeHere>()
.Property( e => e.Text)
.HasColumnType( "text" );
Run Code Online (Sandbox Code Playgroud)