Alv*_*vin 5 c# entity-framework ef-code-first
我正在使用EF 4代码优先.
是否有任何方法可以排除在数据库中创建列?
例如,我想排除Zip要创建的列.
public string Address { get; set; }
[StringLength(40)]
public string City { get; set; }
[StringLength(30)]
public string State { get; set; }
[StringLength(10)]
public string Zip { get; set; }
Run Code Online (Sandbox Code Playgroud)
谢谢.
您可以[NotMapped]向要从数据库中排除的属性添加属性:
public string Address { get; set; }
[StringLength(40)]
public string City { get; set; }
[StringLength(30)]
public string State { get; set; }
[StringLength(10)]
[NotMapped]
public string Zip { get; set; }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1962 次 |
| 最近记录: |