I have problem with NHibernate:

WCF Service hosted in Windows Service. The service's endpoint using
netMsmqBinding.

<service behaviorConfiguration="metadataEnableBehavior"
name="Service1">
    <endpoint address="net.msmq://localhost/private/MyQueue"
     binding="netMsmqBinding"
bindingConfiguration="myBindingConfiguration"
     contract="Ktr.Sezam.Integration.IIntegrationService" />

   <netMsmqBinding>
    <binding name="myBindingConfiguration" closeTimeout="00:05:00"
     openTimeout="00:05:00" sendTimeout="00:05:00"
deadLetterQueue="System"
     exactlyOnce="true" maxRetryCycles="3"
receiveErrorHandling="Fault"
     receiveRetryCount="2" retryCycleDelay="00:03:10"
timeToLive="24.20:00:00"
     useSourceJournal="false" useMsmqTracing="false">
     <security mode="None" />
    </binding>
   </netMsmqBinding>

Win servce:

    public partial class Service : ServiceBase
    {

        public Service()
        {
            InitializeComponent();
            builder = new DefaultServiceHostBuilder
(IoC.Container.Kernel);
        }

        bool shouldCloseUoW;
        protected override void OnStart(string[] args)
        {
            Start();
        }

        public void Start()
        {
                        shouldCloseUoW = false;
                        if (!UnitOfWork.IsStarted)
                        {
                                UnitOfWork.Start();
                                shouldCloseUoW = true;
                        }
                ...
        }

        protected override void OnStop()
        {
                        if (shouldCloseUoW)
                        {
                                if (UnitOfWork.IsStarted)
                                {
                                        UnitOfWork.Current.Dispose();
                                }
                        }
                ...
        }

WCF service:

        [ServiceBehavior(InstanceContextMode =
InstanceContextMode.Single,
ConcurrencyMode = ConcurrencyMode.Single)]
        public class IntegrationService : IIntegrationService
        {

                [OperationBehavior(TransactionScopeRequired = true,
TransactionAutoComplete = true)]
                public void AddToQueue(IntegrationDescriptorMessage
syncDataDescriptorMessage)
                {
                        using (var scope =
                                new
System.Transactions.TransactionScope
(TransactionScopeOption.RequiresNew))
                        {
                                using (var session = new SessionScope
(FlushAction.Never))
                                {
                                        integrationManager.DoSyncData
(syncDataDescriptorMessage);
                                }
                                scope.Complete();
                        }
                }
        }

In syncDataDescriptorMessage i have property Id.
1. DoSyncDat executes query
                                        Repository<DbCategory>.FindOne
(
 
DetachedCriteria.For<DbCategory>().
                                                SetFetchMode
("Children", FetchMode.Join).
                                                SetFetchMode
("Parents", FetchMode.Join)
                                                SetFetchMode
("Parents.Parent", FetchMode.Join).
                                                Add(Restrictions.IdEq
(syncDataDescriptorMessage.Identifier)));
  in sql profiler i have log:
        exec sp_executesql N'SELECT .... FROM DbCategory this_ left
outer
join
        DbCategoryStructure parents2_ on this_.Id=parents2_.Category
left
outer
        join DbCategory dbcategory3_ on
parents2_.Parent=dbcategory3_.Id left
outer
        join DbCategoryStructure children4_ on
this_.Id=children4_.Parent
WHERE this_.Id = @p0',N'@p0 bigint',@p0=5570560
  its work correctly

2. but when next message from queue i processed with different id the
query looks like this:
        exec sp_executesql N'SELECT ..... FROM DbCategory this_ left
outer
join DbCategoryStructure parents2_ on
        this_.Id=parents2_.Category left outer join DbCategory
dbcategory3_
on
        parents2_.Parent=dbcategory3_.Id left outer join
DbCategoryStructure
children4_ on this_.Id=children4_.Parent
        WHERE this_.Id = @p0 and this_.Id = @p1',N'@p0 bigint,@p1
bigint',@p0=5570560,@p1=5570561 <----- old and new id
   and its doesnt work. Query doesnt resturns any object.
3. Each next query execution adds new param to query and doesnt
returns any values.

Why is this happend? Can anybody help me?
Best regards

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to