Beispiel #1
0
 void initLazyLoaders(bool newOrder)
 {
     _OemInfoLoader = new LazyLoader <OEMInfo>(() => OEMService.QueryOEMById(OEMID.Value));
     if (newOrder)
     {
         _applyformLoader    = new EnumerableLazyLoader <BaseApplyform>();
         _operationLoader    = new EnumerableLazyLoader <Log.Domain.OrderLog>();
         _coordinationLoader = new EnumerableLazyLoader <Coordination>();
     }
     else
     {
         _applyformLoader = new EnumerableLazyLoader <BaseApplyform>(() => {
             return(ApplyformQueryService.QueryApplyforms(this.Id));
         });
         _operationLoader = new EnumerableLazyLoader <Log.Domain.OrderLog>(() => {
             return(LogService.QueryOrderLog(this.Id));
         });
         _coordinationLoader = new EnumerableLazyLoader <Coordination>(() => {
             return(CoordinationService.QueryOrderCoordinations(this.Id));
         });
     }
     _associateOrderLoader   = new LazyLoader <Order>();
     _distributionBillLoader = new LazyLoader <Service.Distribution.Domain.OrderBill>(() => {
         return(DistributionQueryService.QueryOrderBill(this.Id));
     });
 }
Beispiel #2
0
 private void StopListeners()
 {
     DebugTrace.TraceEnter(this, "StopListeners");
     if (this.twoPhaseCommitCoordinatorListener != null)
     {
         this.twoPhaseCommitCoordinatorListener.Stop();
         this.twoPhaseCommitCoordinatorListener = null;
     }
     if (this.twoPhaseCommitParticipantListener != null)
     {
         this.twoPhaseCommitParticipantListener.Stop();
         this.twoPhaseCommitParticipantListener = null;
     }
     if (this.completionCoordinatorListener != null)
     {
         this.completionCoordinatorListener.Stop();
         this.completionCoordinatorListener = null;
     }
     if (this.registrationCoordinatorListener != null)
     {
         this.registrationCoordinatorListener.Stop();
         this.registrationCoordinatorListener = null;
     }
     if (this.activationCoordinatorListener != null)
     {
         this.activationCoordinatorListener.Stop();
         this.activationCoordinatorListener = null;
     }
     if (this.coordination != null)
     {
         this.coordination.Cleanup();
         this.coordination = null;
     }
     DebugTrace.TraceLeave(this, "StopListeners");
 }
 private CoordinationService GetCoordinationService()
 {
     if (this.coordinationService == null)
     {
         lock (this.proxyLock)
         {
             if (this.coordinationService == null)
             {
                 try
                 {
                     CoordinationServiceConfiguration config = new CoordinationServiceConfiguration {
                         Mode = CoordinationServiceMode.Formatter,
                         RemoteClientsEnabled = this.wsatConfig.RemoteActivationService(this.protocolVersion) != null
                     };
                     this.coordinationService = new CoordinationService(config, this.protocolVersion);
                 }
                 catch (MessagingInitializationException exception)
                 {
                     DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Error);
                     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionException(System.ServiceModel.SR.GetString("WsatMessagingInitializationFailed"), exception));
                 }
             }
         }
     }
     return(this.coordinationService);
 }
Beispiel #4
0
        //=============================================================================================
        //[SuppressMessage(FxCop.Category.Security, FxCop.Rule.AptcaMethodsShouldOnlyCallAptcaMethods, Justification = "We call PartialTrustHelpers.DemandForFullTrust().")]
        CoordinationService GetCoordinationService()
        {
            if (this.coordinationService == null)
            {
                lock (this.proxyLock)
                {
                    if (this.coordinationService == null)
                    {
                        // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.

                        /*
                         * // We demand full trust because CoordinationService is defined in a non-APTCA assembly and can call Environment.FailFast.
                         * // It's recommended to not let partially trusted callers to bring down the process.
                         * System.Runtime.PartialTrustHelpers.DemandForFullTrust();
                         */

                        try
                        {
                            CoordinationServiceConfiguration config = new CoordinationServiceConfiguration();
                            config.Mode = CoordinationServiceMode.Formatter;
                            config.RemoteClientsEnabled = this.wsatConfig.RemoteActivationService(this.protocolVersion) != null;
                            this.coordinationService    = new CoordinationService(config, this.protocolVersion);
                        }
                        catch (MessagingInitializationException e)
                        {
                            DiagnosticUtility.TraceHandledException(e, TraceEventType.Error);
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                                      new TransactionException(SR.GetString(SR.WsatMessagingInitializationFailed), e));
                        }
                    }
                }
            }

            return(this.coordinationService);
        }
Beispiel #5
0
 public void RecoveryBeginning()
 {
     DebugTrace.TraceEnter(this, "RecoveryBeginning");
     if (this.config.NetworkEndpointsEnabled)
     {
         try
         {
             this.coordination = new CoordinationService(this.config.PortConfiguration, this.protocolVersion);
             this.activationCoordinatorListener     = this.coordination.Add(this.activationCoordinator);
             this.registrationCoordinatorListener   = this.coordination.Add(this.registrationCoordinator);
             this.completionCoordinatorListener     = this.coordination.Add(this.completionCoordinator);
             this.twoPhaseCommitCoordinatorListener = this.coordination.Add(this.twoPhaseCommitCoordinator);
             this.twoPhaseCommitParticipantListener = this.coordination.Add(this.twoPhaseCommitParticipant);
         }
         catch (MessagingInitializationException exception)
         {
             if (DebugTrace.Error)
             {
                 DebugTrace.Trace(TraceLevel.Error, "Error initializing CoordinationService: {0}", exception);
             }
             this.CleanupOnFailure();
             throw Microsoft.Transactions.Bridge.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new PluggableProtocolException(exception.Message, exception));
         }
         catch (Exception exception2)
         {
             if (DebugTrace.Error)
             {
                 DebugTrace.Trace(TraceLevel.Error, "Unknown exception initializing CoordinationService: {0}", exception2);
             }
             this.CleanupOnFailure();
             throw;
         }
     }
     DebugTrace.TraceLeave(this, "RecoveryBeginning");
 }
 protected Proxy(CoordinationService coordination, EndpointAddress to, EndpointAddress from)
 {
     this.coordinationService = coordination;
     this.to = to;
     this.from = from;
     this.protocolVersion = coordination.ProtocolVersion;
     this.coordinationStrings = CoordinationStrings.Version(coordination.ProtocolVersion);
     this.atomicTransactionStrings = AtomicTransactionStrings.Version(coordination.ProtocolVersion);
 }
Beispiel #7
0
 void initLazyLoaders()
 {
     _operationLoader    = new EnumerableLazyLoader <Log.Domain.OrderLog>(() => LogService.QueryApplyformLog(this.Id));
     _coordinationLoader = new EnumerableLazyLoader <Coordination>(() => CoordinationService.QueryApplyformCoordinations(this.Id));
     _orderLoader        = new LazyLoader <Order>(() => OrderQueryService.QueryOrder(this.OrderId));
     _purchaserLoader    = new LazyLoader <DataTransferObject.Organization.CompanyInfo>(() => Organization.CompanyService.GetCompanyDetail(this.PurchaserId));
     _providerLoader     = new LazyLoader <DataTransferObject.Organization.CompanyInfo>(() => Organization.CompanyService.GetCompanyDetail(this.ProviderId));
     _OemInfoLoader      = new LazyLoader <OEMInfo>(() => OEMService.QueryOEMById(OEMID.Value));
 }
        public static IWSActivationCoordinator Instance(CoordinationService service, IActivationCoordinator dispatch)
        {
            ProtocolVersionHelper.AssertProtocolVersion(service.ProtocolVersion, typeof(ActivationCoordinatorDispatcher), "Instance");
            switch (service.ProtocolVersion)
            {
                case ProtocolVersion.Version10:
                    return new ActivationCoordinatorDispatcher10(service, dispatch);

                case ProtocolVersion.Version11:
                    return new ActivationCoordinatorDispatcher11(service, dispatch);
            }
            return null;
        }
        public static IWSTwoPhaseCommitParticipant Instance(CoordinationService service, ITwoPhaseCommitParticipant dispatch)
        {
            ProtocolVersionHelper.AssertProtocolVersion(service.ProtocolVersion, typeof(TwoPhaseCommitParticipantDispatcher), "V");
            switch (service.ProtocolVersion)
            {
                case ProtocolVersion.Version10:
                    return new TwoPhaseCommitParticipantDispatcher10(service, dispatch);

                case ProtocolVersion.Version11:
                    return new TwoPhaseCommitParticipantDispatcher11(service, dispatch);
            }
            return null;
        }
Beispiel #10
0
        //=============================================================================================
        // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.

        /*
         * [PermissionSet(SecurityAction.Demand, Unrestricted = true)] // because we call code from a non-APTCA assembly; WSATs are not supported in partial trust, so customers should not be broken by this demand
         */
        ActivationProxy CreateActivationProxy(EndpointAddress address)
        {
            CoordinationService coordination = GetCoordinationService();

            try
            {
                return(coordination.CreateActivationProxy(address, false));
            }
            catch (CreateChannelFailureException e)
            {
                DiagnosticUtility.TraceHandledException(e, TraceEventType.Error);
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                          new TransactionException(SR.GetString(SR.WsatProxyCreationFailed), e));
            }
        }
        private ActivationProxy CreateActivationProxy(EndpointAddress address)
        {
            ActivationProxy     proxy;
            CoordinationService coordinationService = this.GetCoordinationService();

            try
            {
                proxy = coordinationService.CreateActivationProxy(address, false);
            }
            catch (CreateChannelFailureException exception)
            {
                DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Error);
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionException(System.ServiceModel.SR.GetString("WsatProxyCreationFailed"), exception));
            }
            return(proxy);
        }
Beispiel #12
0
 public void Setup()
 {
     TestDatabase = new TestDatabase();
     Context      = new AppDbContext(TestDatabase.ContextOptions);
     Context.AddTestData();
     CS = new CoordinationService(
         new CoordinationRepository(Context),
         new NotificationService(new NotificationRepository(Context), new UnitOfWork(Context)),
         new PublisherRepository(Context),
         new CategoryRepository(Context),
         new TagsRepository(Context),
         new UnitOfWork(Context),
         new GitlabService(new DatasetServiceTests.SoullessGitlabCLient(), new Microsoft.Extensions.Configuration.ConfigurationBuilder().Build()));
     ExampleV = new Coordination
     {
         Id                = 103,
         Title             = "Samordning av museumsdata",
         Description       = "Dette er en samordning av data rundt museumer i kommunene: Bodø og Trondheim",
         PublisherId       = 100,
         CategoryId        = 100,
         UnderCoordination = false
     };
 }
 public RegistrationCoordinatorDispatcher(CoordinationService service, IRegistrationCoordinator dispatch)
 {
     this.service = service;
     this.dispatch = dispatch;
 }
 public ActivationCoordinatorDispatcher11(CoordinationService service, IActivationCoordinator dispatch)
 {
     ProtocolVersionHelper.AssertProtocolVersion11(service.ProtocolVersion, typeof(ActivationCoordinatorDispatcher11), "constr");
     this.activationCoordinatorDispatcher = new ActivationCoordinatorDispatcher(service, dispatch);
 }
 public TwoPhaseCommitParticipantDispatcher11(CoordinationService service, ITwoPhaseCommitParticipant dispatch)
 {
     ProtocolVersionHelper.AssertProtocolVersion11(service.ProtocolVersion, typeof(TwoPhaseCommitParticipantDispatcher11), "constr");
     this.twoPhaseCommitParticipantDispatcher = new TwoPhaseCommitParticipantDispatcher(service, dispatch);
 }
 public TwoPhaseCommitParticipantDispatcher(CoordinationService service, ITwoPhaseCommitParticipant dispatch) : base(service.ProtocolVersion)
 {
     this.service = service;
     this.dispatch = dispatch;
     this.protocolVersion = service.ProtocolVersion;
 }
 public RegistrationProxy(CoordinationService coordination, EndpointAddress to) : base(coordination, to)
 {
 }
 public TwoPhaseCommitCoordinatorDispatcher10(CoordinationService service, ITwoPhaseCommitCoordinator dispatch)
 {
     ProtocolVersionHelper.AssertProtocolVersion10(service.ProtocolVersion, typeof(TwoPhaseCommitCoordinatorDispatcher10), "constr");
     this.twoPhaseCommitCoordinatorDispatcher = new TwoPhaseCommitCoordinatorDispatcher(service, dispatch);
 }
        //=============================================================================================
        //[SuppressMessage(FxCop.Category.Security, FxCop.Rule.AptcaMethodsShouldOnlyCallAptcaMethods, Justification = "We call PartialTrustHelpers.DemandForFullTrust().")]
        CoordinationService GetCoordinationService()
        {
            if (this.coordinationService == null)
            {
                lock (this.proxyLock)
                {
                    if (this.coordinationService == null)
                    {
                        // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.
                        /*
                        // We demand full trust because CoordinationService is defined in a non-APTCA assembly and can call Environment.FailFast.
                        // It's recommended to not let partially trusted callers to bring down the process.
                        System.Runtime.PartialTrustHelpers.DemandForFullTrust();
                        */

                        try
                        {
                            CoordinationServiceConfiguration config = new CoordinationServiceConfiguration();
                            config.Mode = CoordinationServiceMode.Formatter;
                            config.RemoteClientsEnabled = this.wsatConfig.RemoteActivationService(this.protocolVersion) != null;
                            this.coordinationService = new CoordinationService(config, this.protocolVersion);
                        }
                        catch (MessagingInitializationException e)
                        {
                            DiagnosticUtility.TraceHandledException(e, TraceEventType.Error);
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                                new TransactionException(SR.GetString(SR.WsatMessagingInitializationFailed), e));
                        }
                    }
                }
            }

            return this.coordinationService;
        }
 public CompletionCoordinatorDispatcher(CoordinationService service, ICompletionCoordinator dispatch) : base(service.ProtocolVersion)
 {
     this.service = service;
     this.dispatch = dispatch;
 }
 private CoordinationService GetCoordinationService()
 {
     if (this.coordinationService == null)
     {
         lock (this.proxyLock)
         {
             if (this.coordinationService == null)
             {
                 try
                 {
                     CoordinationServiceConfiguration config = new CoordinationServiceConfiguration {
                         Mode = CoordinationServiceMode.Formatter,
                         RemoteClientsEnabled = this.wsatConfig.RemoteActivationService(this.protocolVersion) != null
                     };
                     this.coordinationService = new CoordinationService(config, this.protocolVersion);
                 }
                 catch (MessagingInitializationException exception)
                 {
                     DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Error);
                     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionException(System.ServiceModel.SR.GetString("WsatMessagingInitializationFailed"), exception));
                 }
             }
         }
     }
     return this.coordinationService;
 }
 public TwoPhaseCommitParticipantProxy(CoordinationService coordination, EndpointAddress to, EndpointAddress from) : base(coordination, to, from)
 {
 }
 public RegistrationCoordinatorDispatcher11(CoordinationService service, IRegistrationCoordinator dispatch)
 {
     ProtocolVersionHelper.AssertProtocolVersion11(service.ProtocolVersion, typeof(RegistrationCoordinatorDispatcher11), "constr");
     this.registrationCoordinatorDispatcher = new RegistrationCoordinatorDispatcher(service, dispatch);
 }
 public ActivationProxy(CoordinationService coordination, EndpointAddress to) : base(coordination, to)
 {
 }
 public void RecoveryBeginning()
 {
     DebugTrace.TraceEnter(this, "RecoveryBeginning");
     if (this.config.NetworkEndpointsEnabled)
     {
         try
         {
             this.coordination = new CoordinationService(this.config.PortConfiguration, this.protocolVersion);
             this.activationCoordinatorListener = this.coordination.Add(this.activationCoordinator);
             this.registrationCoordinatorListener = this.coordination.Add(this.registrationCoordinator);
             this.completionCoordinatorListener = this.coordination.Add(this.completionCoordinator);
             this.twoPhaseCommitCoordinatorListener = this.coordination.Add(this.twoPhaseCommitCoordinator);
             this.twoPhaseCommitParticipantListener = this.coordination.Add(this.twoPhaseCommitParticipant);
         }
         catch (MessagingInitializationException exception)
         {
             if (DebugTrace.Error)
             {
                 DebugTrace.Trace(TraceLevel.Error, "Error initializing CoordinationService: {0}", exception);
             }
             this.CleanupOnFailure();
             throw Microsoft.Transactions.Bridge.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new PluggableProtocolException(exception.Message, exception));
         }
         catch (Exception exception2)
         {
             if (DebugTrace.Error)
             {
                 DebugTrace.Trace(TraceLevel.Error, "Unknown exception initializing CoordinationService: {0}", exception2);
             }
             this.CleanupOnFailure();
             throw;
         }
     }
     DebugTrace.TraceLeave(this, "RecoveryBeginning");
 }
 public CompletionParticipantProxy(CoordinationService coordination, EndpointAddress to) : base(coordination, to, null)
 {
 }
 private void StopListeners()
 {
     DebugTrace.TraceEnter(this, "StopListeners");
     if (this.twoPhaseCommitCoordinatorListener != null)
     {
         this.twoPhaseCommitCoordinatorListener.Stop();
         this.twoPhaseCommitCoordinatorListener = null;
     }
     if (this.twoPhaseCommitParticipantListener != null)
     {
         this.twoPhaseCommitParticipantListener.Stop();
         this.twoPhaseCommitParticipantListener = null;
     }
     if (this.completionCoordinatorListener != null)
     {
         this.completionCoordinatorListener.Stop();
         this.completionCoordinatorListener = null;
     }
     if (this.registrationCoordinatorListener != null)
     {
         this.registrationCoordinatorListener.Stop();
         this.registrationCoordinatorListener = null;
     }
     if (this.activationCoordinatorListener != null)
     {
         this.activationCoordinatorListener.Stop();
         this.activationCoordinatorListener = null;
     }
     if (this.coordination != null)
     {
         this.coordination.Cleanup();
         this.coordination = null;
     }
     DebugTrace.TraceLeave(this, "StopListeners");
 }
 public CoordinationServiceHost(CoordinationService service, object serviceInstance)
 {
     this.service = service;
     base.InitializeDescription(serviceInstance, new UriSchemeKeyedCollection(new Uri[0]));
 }
 public ActivationCoordinatorDispatcher(CoordinationService service, IActivationCoordinator dispatch)
 {
     this.service = service;
     this.dispatch = dispatch;
 }
 public CompletionCoordinatorDispatcher10(CoordinationService service, ICompletionCoordinator dispatch)
 {
     ProtocolVersionHelper.AssertProtocolVersion10(service.ProtocolVersion, typeof(CompletionCoordinatorDispatcher10), "constr");
     this.completionCoordinatorDispatcher = new CompletionCoordinatorDispatcher(service, dispatch);
 }
 public CompletionParticipantDispatcher11(CoordinationService service, ICompletionParticipant dispatch)
 {
     ProtocolVersionHelper.AssertProtocolVersion11(service.ProtocolVersion, typeof(CompletionParticipantDispatcher11), "constr");
     this.completionParticipantDispatcher = new CompletionParticipantDispatcher(service, dispatch);
 }