How do I use an identity column instead of GUIDs?
You can use IDENTITY columns along with the GUIDs (the GUID primary key cannot be removed).
Here are the steps for SQL Server:
- Add the following to your domain class (or classes):
private Int64 _ID; [Number(IsGeneratedByPersistence = true)] public Int64 ID { get { return _ID; } internal set { _ID = value; } }
- Re-compile your domain assembly.
- Run DataBridge against the assembly, and create the mapping and schema files.
- All ID columns will generated as IDENTITY columns.
- Create your database using the SQL schema file.
TrueView uses GUIDs to keep the domain layer decoupled from the persistence layer. However, we do appreciate that many people find numbers easier to work with.
