0
我有错误的列Id不能包含空值,但我在IsDbGenerated上设置为true。我究竟做错了什么?自动增量字段没有被自动设置
private int id;
[Column(IsPrimaryKey=true, CanBeNull=false, DbType="int", IsDbGenerated=true)]
public int Id
{
get { return id; }
set
{
if (id != value)
{
id = value;
RaisePropertyChanged("Id");
}
}
}
怎么样数据库。你有没有在数据库中设置idetity = yes – Tassadaque
它是独立存储中Windows Phone的sdf(SQLce)。 – user384080
http://www.any-ti.me/manually-setting-autoincrement-identity-fields-in-sqlce-31-and-35.aspx – Tassadaque