If you are using migrations you should be able to simply modify code based migration to use newsequentialid() as DefaultValueSql.
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public override void Up() { CreateTable( "SomeTable", c => new { Id = c.Guid(nullable: false, defaultValueSql: "newsequentialid()"), }) .PrimaryKey(t => t.Id) ); }
阅读全文
公众号近期文章
赞赏支持
0 Responses to “Entity Framework code first newsequentialid() Guid 主键”