I want to use a Guid as the primary key. Pls no discussion upon it is better not to use. We have to replicate the database with others, so an integer key cannot guranty not to be duplicated.
as I read, if I want SQLite to return the newly generated key. But therefor the key column must have the attribute NOT NULL, otherwise I'm getting an exception. How can I acheave this? In the code I have seen, that in "AddNullConstraintIfNecessary" a "NotNullConstraint" will not be generated, if the property is an identity property. But here I need it.
May be I have overseen something.
I want to use a Guid as the primary key. Pls no discussion upon it is better not to use. We have to replicate the database with others, so an integer key cannot guranty not to be duplicated.
I have to decorate the key with
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
as I read, if I want SQLite to return the newly generated key. But therefor the key column must have the attribute NOT NULL, otherwise I'm getting an exception. How can I acheave this? In the code I have seen, that in "AddNullConstraintIfNecessary" a "NotNullConstraint" will not be generated, if the property is an identity property. But here I need it.