Id columns can specify a generator. Perfect.
However, I have a situation in which I need to assign a generated value to a property column if it is null. Think something along the lines of an invoice table where there's a surrogate primary key column and an Invoice Number column.
CREATE TABLE dbo.Invoice (InvoiceId INT NOT NULL PRIMARY KEY IDENTITY(1,1), InvoiceNumber INT NOT NULL, InvoiceDate DATETIME NOT NULL, remaining columns...)
This isn't a default value. The Invoice Number might have certain rules around it's generation. I have a C# class that handles the actual generation, I just need to find a way to populate the value of the property on the Invoice class.
Ideally I'd be able to specify a generator for a property like I do for an Id in the mapping. Unfortunately, that doesn't seem possible from what I can determine. I'm hoping I'm wrong.
I have other, non-nHibernate options I could employ like using a trigger, inserting the generation into the provider. However, I'd like to keep it a configuration option rather than a coding option.
Does anyone know if a such an ability exists?