azurenservicebussaganservicebus-sagas

NServiceBus AzureSagaPersistence schema issue


I have updated my saga data class by adding one more DateTime property and everything went to hell. The schema wasn't updated and I started to get exceptions on each saga message, but I had no important data there so I removed the table.

Since then, the saga data table is being created like this: enter image description here

No fields from the Saga data class are present in the schema.

Here is my saga data class:

public class ModuleAliveSagaData : ContainSagaData
{
    [Unique]
    public string ModuleId { get; set; }
    public string Endpoint { get; set; }
    public string Module { get; set; }
    public DateTime LastCheck { get; set; }
    public DateTime LastWarning { get; set; }
    public bool Warning { get; set; }
    public bool Error { get; set; }
}

What's wrong there? Before I removed the saga data table, it was perfectly fine.

Update: I removed the second DateTime field from my data class, removed the table again and it started to work. Why could this be?


Solution

  • What exception did you get?

    PS: Azure storage doesn't have a schema, so as long as you don't put any data into the datetime field, the field doesn't exist.

    I assume that the exception occured because you had existing records in the table without the datetime property in it, while your datetime property requires data. Could you try with DateTime? property type?

    PS: the azure saga persister doesn't support the [Unique] attribute either, if you need uniqueness on properties it's better to take a different persister