# EF CodeFirst Guid ###### tags: `火箭` 在add migration 時 增加defaultValueSql: "newId()" 參數 defaultValueSql: "GETDATE()" 增加當下時間 https://magnussundstrom.se/blog/add-guid-ef-code-first https://iter01.com/422164.html ```csharp= [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid UniqueId { get; set; } protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn<Guid>( name: "UniqueId", table: "Orders", nullable: false, defaultValueSql: "newId()"); } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up