[ SELECT this_.Id as Id0_0_, this_.Originator as Originator0_0_, this_.OriginalMessageId as Original3_0_0_, this_.OrderNumber as OrderNum1_1_0_, this_.Order as Order1_0_, this_._OrderNumber as column3_1_0_, this_._Order as column4_1_0_ FROM OrderPolicyData this_ with (updlock, rowlock) WHERE this_.OrderNumber = @p0 ]
Name:cp0 - Value:12
[SQL: SELECT this_.Id as Id0_0_, this_.Originator as Originator0_0_, this_.OriginalMessageId as Original3_0_0_, this_.OrderNumber as OrderNum1_1_0_, this_.Order as Order1_0_, this_._OrderNumber as column3_1_0_, this_._Order as column4_1_0_ FROM OrderPolicyData this_ with (updlock, rowlock) WHERE this_.OrderNumber = @p0]
When I got to the database, I notice that there is no table called OrderPolicyData. My assumption is that the saga tables are not being created at start up.
Now, the other persistence tables ARE being created. There is a table of "Subscription" and "TimeoutEntity", but no OrderPolicyData table (which I'm assuming would be the saga table needed).
I did notice that for NHibernate to even work I had to mark my SagaData properties as "Overridable" (the C# equivalent of virtual). This is something that I didn't have to do when using RavenDB as my persistence. I'm wondering if there are any other "gotchas" with differences between RavenDB and NHibernate.....
Here is my endpoint config:
Imports System.ConfigurationImports
Imports NServiceBus
Public Class EndpointConfig : Implements IConfigureThisEndpoint, AsA_Server
Public Sub Customize(configuration As BusConfiguration) Implements IConfigureThisEndpoint.Customize
configuration.UsePersistence(Of NHibernatePersistence)()
''disable 2nd level retries - for testing purposes
configuration.DisableFeature(Of Features.SecondLevelRetries)()
''setup unobtrusive messaging conventions
configuration.Conventions.DefiningCommandsAs(Function(r) r.Namespace <> Nothing And r.Namespace.EndsWith("Commands"))
configuration.Conventions.DefiningEventsAs(Function(r) r.Namespace <> Nothing And r.Namespace.EndsWith("Events"))
configuration.Conventions.DefiningMessagesAs(Function(r) r.Namespace <> Nothing And r.Namespace.EndsWith("Messages"))
End Sub
End Class
And here is my saga (its very trivial, just doing a test to get this working):
Imports NServiceBusImports
Imports NServiceBus.Saga
Namespace Policies
Public Class OrderPolicy : Inherits Saga(Of OrderPolicyData) : Implements IAmStartedByMessages(Of Contracts.Commands.StartNewOrder)
Protected Overloads Overrides Sub ConfigureHowToFindSaga(mapper As SagaPropertyMapper(Of OrderPolicyData))
mapper.ConfigureMapping(Of Contracts.Commands.StartNewOrder)(Function(r) r.OrderNumber).ToSaga(Function(r) r.OrderNumber)
End Sub
Public Sub Handle(message As Contracts.Commands.StartNewOrder) Implements IHandleMessages(Of Contracts.Commands.StartNewOrder).Handle
Me.Data.OrderNumber = message.OrderNumber
Me.Data.Order = message.Product
End Sub
End Class
Public Class OrderPolicyData : Inherits ContainSagaData
<Unique>
Public Overridable Property OrderNumber As String
Public Overridable Property Order As String
End Class
End Namespace
NServiceBus Version: 5.2.0NServiceBus.Host Version: 6.0.0
NServiceBus.NHibernate 6.1.2