0

I have a simple IFindSaga implemented, I referred and followed the same steps that was provided in particular software document for SQL Persistence Saga Finding Logic. I'm getting an error at session.GetSagaData<SagaData> stating that: "SynchronizedStorageSession does not contain a definition for GetSagaData and no extension method GetSagaData accepting a first argument of type SynchronizedStorageSession could be found (are you missing a using directive or an assembly reference)." Please help me to solve this.

This is my code where I have implemented IFindSaga

public class TrackerFind : IFindSagas<SagaData>.Using<ITrackerData>
        {
            public Task<SagaData> FindBy(ITrackerData message, SynchronizedStorageSession session, ReadOnlyContextBag context)
            {
                return session.GetSagaData<SagaData>(
                    context: context,
                    whereClause: "JSON_VALUE(Data,'$.PaymentTransactionId') = @propertyValue",
                    appendParameters: (builder, append) =>
                    {
                        var parameter = builder();
                        parameter.ParameterName = "propertyValue";
                        parameter.Value = message.TrackerID;
                        append(parameter);
                    });
            }
        }
Leo
  • 136
  • 2
  • 2
  • 11
  • Are you following this? https://github.com/Particular/docs.particular.net/blob/master/samples/saga/sql-sagafinder/SqlPersistence_2/EndpointSqlServer/OrderSagaFinder.cs – Sean Farmar Jul 10 '17 at 17:28
  • https://docs.particular.net/samples/saga/sql-sagafinder/ Do you have all the needed references? – Sean Farmar Jul 10 '17 at 17:29
  • Note that the code snippets in the NServiceBus documentation have a "Copy usings" option on them that can help for things like this. Also, custom saga finders is a very out-of-the-way feature of NServiceBus, so we (I work for Particular Software) would be very interested in hearing your specific use case for using a custom saga finder here, instead of having the PaymentTransactionId as your normal correlation property. – David Boike Jul 10 '17 at 17:53
  • I have added reference and namespace that was mentioned in the Particular software but still the same error exist. @SeanFarmar – Leo Jul 11 '17 at 03:00
  • @DavidBoike I'm just trying to learn about `IFindSagas`. It would be helpful if you could provide link for simple example source code along with explanation for every step (since I have only a basic knowledge in C#). – Leo Jul 11 '17 at 03:19
  • Can you share your code somehow? (github, bitbucket, dropbox?) – Sean Farmar Jul 11 '17 at 07:38
  • @Leo Do you mean a sample like this? : https://docs.particular.net/nservicebus/sagas/saga-finding – Dennis van der Stelt Jul 13 '17 at 08:54
  • @Sean Farmar I used the following code sample provided in the particular software [code sample link](https://docs.particular.net/samples/saga/sql-sagafinder/). – Leo Jul 14 '17 at 01:29
  • @DennisvanderStelt yes a similar to that. – Leo Jul 14 '17 at 01:30

2 Answers2

0

"GetSagaData" is an extension method which is part of "NserviceBus" namespace. include following statement

using NServiceBus;

This worked for me. I am not getting that error now

Rahul Ruikar
  • 1,076
  • 6
  • 9
-2

use nuget

package NServiceBus.Persistence.Sql

Vitalii Vasylenko
  • 4,776
  • 5
  • 40
  • 64