繁体   English   中英

首先使用实体​​框架模型时,如何映射具有不同数据库类型的字符串

[英]when using entity framework model first, how to map string with different db types

例如:

public string Name { get; set;}
public string Comment { get; set;}

如何使用nvarchar(20)映射Name和使用nvarchar(500)映射Comment?

您可以添加Column

这样的属性;

[Column(DbType="NVarChar(20)")]
public string Name { get; set;}
[Column(DbType="NVarChar(500) NOT NULL")]
public string Comment { get; set;}

SQL-CLR类型映射

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM