Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

entity framework id not auto increment


Use [Key, DatabaseGenerated(DatabaseGeneratedOption.None)] annotation on Id field

public class Item 
{
    [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
    [Required]
    public Guid Id { get; set; }
    public string Name { get; set; }
}
Source by entityframeworkcore.com #
 
PREVIOUS NEXT
Tagged: #entity #framework #id #auto #increment
ADD COMMENT
Topic
Name
5+8 =