I'm attempting to create a Saga with SagaData that contains a complex type.
For example:
public class MySagaData : IContainSagaData
{
public virtual Guid Id { get; set; }
public virtual string Originator { get; set; }
public virtual string OriginalMessageId { get; set; }
public ComplexType MyComplexType { get; set; }
}
Is this possible? If so, how do you map this and is this an anti pattern? I've not found any resources online that talk about doing this which leads me to believe that there is something I'm missing.
This is possible and my team does this often. It somewhat depends on your persistence setup.
If you are using RavenDB it should just work. We take this even a step farther and will have a List(Of ComplexType) and RavenDB stores this without a problem.
If you are doing NHibernate you may have to do some extra mapping to make this work as NHibernate itself has some restrictions / conventions on how objects are serialized and saved (I'm not as familiar with NHibernate as we always use RavenDB for our saga persistence.)