Previously I have been working only with MySQL databases, it was quite a standard to use auto increment integer settings for the id
fields.
Trying Entity Framework with SQLite
database, I have noticed that EF is using a Guid
structure identifiers by default and therefore requires string
for such fields. In the result, we have a identifier looking like that:
a75d9d3d-6543-44fe-9fb8-f19f411503e5
public class AccountDataModel
{
/// <summary>
/// The unique Id
/// </summary>
public string Id { get; set; }
[...]
}
Two questions:
Simply change
public string Id { get; set; }
to
public int Id { get; set; }
and should change your Identity column type int with seed as 1. Use EF migrations to see the code generated for creating tables, keys and relationships.
If you want Id to be int then you should use type int and not string.
public int Id { get; set; }
And for Guid you would use type Guid. Type string is rarely used for Id column.