Loading ...
Sorry, an error occurred while loading the content.

RE: [nservicebus] ConfigureHowToFindSaga Composite Key Lookups

Expand Messages
  • Udi Dahan
    ConfigureHowToFindSaga is a shortcut for the more generic IFindSagas .Using Implement that interface and you ll be able to do any lookup you like. Thanks,
    Message 1 of 5 , Jan 8, 2010
    View Source
    • 0 Attachment

      ConfigureHowToFindSaga is a shortcut for the more generic IFindSagas<T>.Using<M>

      Implement that interface and you'll be able to do any lookup you like.

       

      Thanks,

       

      -- Udi Dahan

       

      From: nservicebus@yahoogroups.com [mailto:nservicebus@yahoogroups.com] On Behalf Of Steve
      Sent: Saturday, January 09, 2010 5:33 AM
      To: nservicebus@yahoogroups.com
      Subject: [nservicebus] ConfigureHowToFindSaga Composite Key Lookups

       

       

      When a saga runs ConfigureHowToFindSaga, can a composite key lookup be done or is it just limited to mapping to one property?

      Here's how it works now... Correct me if I am wrong, but this maps to one property.

      public override ConfigureHowToFindSaga()
      {
      ConfigureMapping<SomeMessage>(s => s.Id, m => m.SomeProp);
      }

      I'd like to do something like this:

      public override void ConfigureHowToFindSaga()
      {
      ConfigureMapping<SomeMessage>.Add(s => s.CompositeA, m => m.CompKey1);
      ConfigureMapping<SomeMessage>.Add(s => s.CompositeB, m => m.CompKey2);
      }

      If composite lookups are possible, can anyone explain how to do that? If not, does the above make sense? Essentially, the Adds would filter into a where with an AND instead of just a WHERE clause.

      Thanks,

      Steve

    • Steve
      Thanks for the info. One thing to note, and this isn t really a big deal... I m building against the trunk and if my saga class implements
      Message 2 of 5 , Jan 14, 2010
      View Source
      • 0 Attachment
        Thanks for the info.  

        One thing to note, and this isn't really a big deal...    I'm building against the trunk and if my saga class implements IFindSagas<T>.Using<M>, then it will not correctly register with the finder.  If I implement the interface in another class separate from my saga it will work as advertised. 

        A quick glance through the code (I'm no expert, just know enough to be dangerous) leads me to NServiceBus.Sagas.Impl.Configure:

        public void SagasIn(IEnumerable<Type> types)
                {
                    foreach (Type t in types)
                    {
                        if (IsSagaType(t))
                        {
                            configurer.ConfigureComponent(t, ComponentCallModelEnum.Singlecall);
                            ConfigureSaga(t);
                            SagasWereFound = true;
                            continue;
                        }

                        if (IsFinderType(t))
                        {
                            configurer.ConfigureComponent(t, ComponentCallModelEnum.Singlecall);
                            ConfigureFinder(t);
                            continue;
                        }
                    }

                    CreateAdditionalFindersAsNecessary();
                }

        Note the IsSagaType and IsFinderType inspection.  As you can see I'm guessing it's skipping the finder registration and some other stuff.

        Again, not a big deal in the least, just figured I'd let you all know.

        Steve


        From: Udi Dahan <thesoftwaresimplist@...>
        To: nservicebus@yahoogroups.com
        Sent: Sat, January 9, 2010 12:30:19 AM
        Subject: RE: [nservicebus] ConfigureHowToFindSaga Composite Key Lookups

         

        ConfigureHowToFindS aga is a shortcut for the more generic IFindSagas<T>.Using<M>

        Implement that interface and you'll be able to do any lookup you like.

         

        Thanks,

         

        -- Udi Dahan

         

        From: nservicebus@ yahoogroups. com [mailto:nservicebus @yahoogroups. com] On Behalf Of Steve
        Sent: Saturday, January 09, 2010 5:33 AM
        To: nservicebus@ yahoogroups. com
        Subject: [nservicebus] ConfigureHowToFindS aga Composite Key Lookups

         

         

        When a saga runs ConfigureHowToFindS aga, can a composite key lookup be done or is it just limited to mapping to one property?

        Here's how it works now... Correct me if I am wrong, but this maps to one property.

        public override ConfigureHowToFindS aga()
        {
        ConfigureMapping<SomeMessage>(s => s.Id, m => m.SomeProp);
        }

        I'd like to do something like this:

        public override void ConfigureHowToFindS aga()
        {
        ConfigureMapping<SomeMessage>.Add(s => s.CompositeA, m => m.CompKey1);
        ConfigureMapping<SomeMessage>.Add(s => s.CompositeB, m => m.CompKey2);
        }

        If composite lookups are possible, can anyone explain how to do that? If not, does the above make sense? Essentially, the Adds would filter into a where with an AND instead of just a WHERE clause.

        Thanks,

        Steve


      • Mikael Henriksson
        Steve, That s also by design. What you do is create a class called MySagaFinder, inherit from IFindSagas .Using Basically your
        Message 3 of 5 , Jan 14, 2010
        View Source
        • 0 Attachment
          Steve,

          That's also by design. What you do is create a class called MySagaFinder, inherit from IFindSagas<MySagaEntity>.Using<MyMessage>
          Basically your SagaFinder is used to first retrieve your saga entity (or create a new saga) and then the data is passed on to your message handler.

          On Thu, Jan 14, 2010 at 4:59 PM, Steve <steveisok1@...> wrote:
           

          Thanks for the info.  

          One thing to note, and this isn't really a big deal...    I'm building against the trunk and if my saga class implements IFindSagas<T>.Using<M>, then it will not correctly register with the finder.  If I implement the interface in another class separate from my saga it will work as advertised. 

          A quick glance through the code (I'm no expert, just know enough to be dangerous) leads me to NServiceBus.Sagas.Impl.Configure:

          public void SagasIn(IEnumerable<Type> types)
                  {
                      foreach (Type t in types)
                      {
                          if (IsSagaType(t))
                          {
                              configurer.ConfigureComponent(t, ComponentCallModelEnum.Singlecall);
                              ConfigureSaga(t);
                              SagasWereFound = true;
                              continue;
                          }

                          if (IsFinderType(t))
                          {
                              configurer.ConfigureComponent(t, ComponentCallModelEnum.Singlecall);
                              ConfigureFinder(t);
                              continue;
                          }
                      }

                      CreateAdditionalFindersAsNecessary();
                  }

          Note the IsSagaType and IsFinderType inspection.  As you can see I'm guessing it's skipping the finder registration and some other stuff.

          Again, not a big deal in the least, just figured I'd let you all know.

          Steve


          From: Udi Dahan <thesoftwaresimplist@...>
          To: nservicebus@yahoogroups.com
          Sent: Sat, January 9, 2010 12:30:19 AM
          Subject: RE: [nservicebus] ConfigureHowToFindSaga Composite Key Lookups

           

          ConfigureHowToFindS aga is a shortcut for the more generic IFindSagas<T>.Using<M>

          Implement that interface and you'll be able to do any lookup you like.

           

          Thanks,

           

          -- Udi Dahan

           

          From: nservicebus@ yahoogroups. com [mailto:nservicebus @yahoogroups. com] On Behalf Of Steve


          Sent: Saturday, January 09, 2010 5:33 AM
          To: nservicebus@ yahoogroups. com
          Subject: [nservicebus] ConfigureHowToFindS aga Composite Key Lookups

           

           

          When a saga runs ConfigureHowToFindS aga, can a composite key lookup be done or is it just limited to mapping to one property?


          Here's how it works now... Correct me if I am wrong, but this maps to one property.

          public override ConfigureHowToFindS aga()
          {
          ConfigureMapping<SomeMessage>(s => s.Id, m => m.SomeProp);
          }

          I'd like to do something like this:

          public override void ConfigureHowToFindS aga()
          {
          ConfigureMapping<SomeMessage>.Add(s => s.CompositeA, m => m.CompKey1);
          ConfigureMapping<SomeMessage>.Add(s => s.CompositeB, m => m.CompKey2);
          }

          If composite lookups are possible, can anyone explain how to do that? If not, does the above make sense? Essentially, the Adds would filter into a where with an AND instead of just a WHERE clause.

          Thanks,

          Steve



        • Steve
          Thanks. I figured it was by design, but just in case it wasn t... Steve ________________________________ From: Mikael Henriksson To:
          Message 4 of 5 , Jan 14, 2010
          View Source
          • 0 Attachment
            Thanks. 

            I figured it was by design, but just in case it wasn't...

            Steve


            From: Mikael Henriksson <mikael@...>
            To: nservicebus@yahoogroups.com
            Sent: Thu, January 14, 2010 11:50:23 AM
            Subject: Re: [nservicebus] ConfigureHowToFindSaga Composite Key Lookups

             

            Steve,


            That's also by design. What you do is create a class called MySagaFinder, inherit from IFindSagas<MySagaEntity>.Using<MyMessage>
            Basically your SagaFinder is used to first retrieve your saga entity (or create a new saga) and then the data is passed on to your message handler.

            On Thu, Jan 14, 2010 at 4:59 PM, Steve <steveisok1@yahoo. com> wrote:
             

            Thanks for the info.  

            One thing to note, and this isn't really a big deal...    I'm building against the trunk and if my saga class implements IFindSagas<T>.Using<M>, then it will not correctly register with the finder.  If I implement the interface in another class separate from my saga it will work as advertised. 

            A quick glance through the code (I'm no expert, just know enough to be dangerous) leads me to NServiceBus. Sagas.Impl. Configure:

            public void SagasIn(IEnumerable<Type> types)
                    {
                        foreach (Type t in types)
                        {
                            if (IsSagaType( t))
                            {
                                configurer.Configur eComponent( t, ComponentCallModelE num.Singlecall) ;
                                ConfigureSaga( t);
                                SagasWereFound = true;
                                continue;
                            }

                            if (IsFinderType( t))
                            {
                                configurer.Configur eComponent( t, ComponentCallModelE num.Singlecall) ;
                                ConfigureFinder( t);
                                continue;
                            }
                        }

                        CreateAdditionalFin dersAsNecessary( );
                    }

            Note the IsSagaType and IsFinderType inspection.  As you can see I'm guessing it's skipping the finder registration and some other stuff.

            Again, not a big deal in the least, just figured I'd let you all know.

            Steve


            From: Udi Dahan <thesoftwaresimplist @udidahan. com>
            To: nservicebus@ yahoogroups. com
            Sent: Sat, January 9, 2010 12:30:19 AM
            Subject: RE: [nservicebus] ConfigureHowToFindS aga Composite Key Lookups

             

            ConfigureHowToFindS aga is a shortcut for the more generic IFindSagas<T>.Using<M>

            Implement that interface and you'll be able to do any lookup you like.

             

            Thanks,

             

            -- Udi Dahan

             

            From: nservicebus@ yahoogroups. com [mailto:nservicebus @yahoogroups. com] On Behalf Of Steve


            Sent: Saturday, January 09, 2010 5:33 AM
            To: nservicebus@ yahoogroups. com
            Subject: [nservicebus] ConfigureHowToFindS aga Composite Key Lookups

             

             

            When a saga runs ConfigureHowToFindS aga, can a composite key lookup be done or is it just limited to mapping to one property?


            Here's how it works now... Correct me if I am wrong, but this maps to one property.

            public override ConfigureHowToFindS aga()
            {
            ConfigureMapping<SomeMessage>(s => s.Id, m => m.SomeProp);
            }

            I'd like to do something like this:

            public override void ConfigureHowToFindS aga()
            {
            ConfigureMapping<SomeMessage>.Add(s => s.CompositeA, m => m.CompKey1);
            ConfigureMapping<SomeMessage>.Add(s => s.CompositeB, m => m.CompKey2);
            }

            If composite lookups are possible, can anyone explain how to do that? If not, does the above make sense? Essentially, the Adds would filter into a where with an AND instead of just a WHERE clause.

            Thanks,

            Steve




          Your message has been successfully submitted and would be delivered to recipients shortly.