Yet I have neither available (ReturnAttribute or ReturnOnInsertAttribute) in version 5.0.2. Am I missing something?
Out of our 78 Domain models, 70 of them use Guid PK’s, and I would like to refrain from the code in the previous question linked all throughout our codebase.
Nevermind, looking through the commit logs, it looks as though this wasn’t really introduced until after the 5.0.2 release (which is why I don’t see it).
I like where it’s going though! Any timelines for when this is slated for release?
That’s only for sequences, but I’ve just added for Auto populating GUID’s in this commit which will let you specify that you want to auto populate GUID Primary Keys with:
public class Table
{
[AutoId]
public Guid Id { get; set; }
}
It uses newid() for SQL Server and uuid_generate_v4() for PostgreSQL which requires installing the extension on the DB it’s used:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
Where it will return the value populated by the RDBMS, in all other RDBMS’s OrmLite will populate the Guid on INSERT with Guid.NewGuid(). In all DB’s it will populate the instance with the auto populated GUID, e.g:
var row = new Table { ... };
db.Insert(row);
row.Id //= Auto populated with new Guid