luca giordano
unread,May 14, 2013, 5:14:17 AM5/14/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to masstransit-discuss
Hi all,
the exception:
Unable to cast object of type 'Automatonymous.CompositeEventStatus' to
type 'Automatonymous.State'....
at
Automatonymous.NHibernateIntegration.CompositeEventStateUserType.NHibernate.UserTypes.IUserType.Equals(Object
x, Object y)
The map
public class CatalogSagaMap :
ClassMap<CatalogInstance>
{
public CatalogSagaMap()
{
Id(x => x.CorrelationId).GeneratedBy.Assigned();
Map(x =>
x.CompositeStatus).CustomType<CompositeEventStateUserType>();
....
}
}
The instance
public class CatalogInstance : SagaStateMachineInstance
{
public CatalogInstance()
{
}
public CatalogInstance(Guid correlationId)
:this()
{
CorrelationId = correlationId;
}
public CompositeEventStatus CompositeStatus { get; set; }
..........
public Guid CorrelationId { get; set; }
public IServiceBus Bus { get; set; }
}
And the Saga
....
public class CatalogSaga :
AutomatonymousStateMachine<CatalogInstance>
{
public CatalogSaga()
{
InstanceState(x => x.CurrentState);
Event(() => PreCheckAcknowledged);
Event(() => PreCheckCompleted);
Event(() => PreChecked, x => x.CompositeStatus,
PreCheckAcknowledged, PreCheckCompleted);
................
}
public Event<PreconditionChecked> PreCheckCompleted { get;
private set; }
public Event<Acknowledge<PreConditionCheck>>
PreCheckAcknowledged { get; private set; }
public Event PreChecked { get; private set; }
.....
Everything works fine - in memory - but I'm not able to persist the
CompositeEventStatus through nhibernate.
It should be mapped on an int type. If I let the framework create the
table (sqlserver) it's mapped as varbinary(max) unless registered as
customtype :( .
If customtype used there's no way to use nhibernate because of the
exception above.
Any help would be appreciated.
Thanks,
Luca