I am using the ADO.NET Firebird provider with the Entity Framework, but this question also applies to other providers.
I have a field on my model as follows
[Column("JOBNO"), DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int JobNo { get; set; }
In the database, I have a βon insertβ trigger that updates the JOBNO field with a generator if JOBNO set to NULL
By setting the DatabaseGenerated attribute in DatabaseGeneratedOption.Identity in the model field, the framework structure correctly pulls JOBNO out of the database upon insertion.
However, sometimes I want to manually specify the JOBNO column when inserting, but EF does not understand and simply uses the generated value.
Is there a way to enable this conditional setting of the DatabaseGenerated field?
source share