This is the proper way of creating a PK without Identity Autoincrement enabled:
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public string FooId { get; set; }
More Related Contents:
- EF Code-First One-to-one relationship: Multiplicity is not valid in Role * in relationship
- Entity Framework .Remove() vs. .DeleteObject()
- Entity Framework Provider type could not be loaded?
- How to update record using Entity Framework 6?
- How can I log the generated SQL from DbContext.SaveChanges() in my Program? [duplicate]
- Validation failed for one or more entities while saving changes to SQL Server Database using Entity Framework
- How to compare only Date without Time in DateTime types in Linq to SQL with Entity Framework?
- Entity Framework 6 GUID as primary key: Cannot insert the value NULL into column ‘Id’, table ‘FileStore’; column does not allow nulls
- SQL WHERE clause matching values with trailing spaces
- Mapping composite keys using EF code first
- Setting unique Constraint with fluent API?
- Lazy Loading vs Eager Loading
- Entity Framework error: Cannot insert explicit value for identity column in table
- Dynamic MySQL database connection for Entity Framework 6
- Entity Framework 6 Code First Custom Functions
- How to disable cascade delete for link tables in EF code-first?
- Entity Framework – stored procedure return value
- Problems using Entity Framework 6 and SQLite
- SqlConnection.Close() inside using statement
- Database.BeginTransaction vs Transactions.TransactionScope [duplicate]
- Configure multiple database Entity Framework 6
- Join and Include in Entity Framework
- Entity Framework 6 transaction rollback
- Log Queries executed by Entity Framework DbContext
- How are people unit testing with Entity Framework 6, should you bother?
- Async PartialView causes “HttpServerUtility.Execute blocked…” exception
- How to group by DateTime.Date in EntityFramework
- Is SqlConnection.Close() need inside a Using statement?
- Update-Database command is not working in ASP.Net Core / Entity Framework Core because object in database already exists
- How can set a default value constraint with Entity Framework 6 Code First?