示例#1
0
        public void Initialize()
        {
            ConfigureFromCanConfigurables();
            InitializeCulture();

            var initializers = new Action[] {
                () => Serialization.Initialize(Container),
                () => Commands.Initialize(Container),
                () => Events.Initialize(Container),
                () => Tasks.Initialize(Container),
                () => Views.Initialize(Container),
                () => Sagas.Initialize(Container),
                () => Frontend.Initialize(Container),
                () => CallContext.Initialize(Container),
                () => ExecutionContext.Initialize(Container),
                () => Security.Initialize(Container),
                () => DefaultStorage.Initialize(Container)
            };

#if (SILVERLIGHT)
            initializers.ForEach(initializer => initializer());
#else
            Parallel.ForEach(initializers, initializator => initializator());
#endif
            ConfigurationDone();
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Sagas sagas = db.Sagas.Find(id);

            db.Sagas.Remove(sagas);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
        public SagaInfo[] GetReactingSagas(AggregateEventInfo aggregateEventInfo)
        {
            if (aggregateEventInfo == null)
            {
                throw new ArgumentNullException(nameof(aggregateEventInfo));
            }

            return(Sagas.Where(x => x.AggregateEvents.Contains(aggregateEventInfo)).ToArray());
        }
示例#4
0
 public ActionResult Edit([Bind(Include = "id_sagas,nombre_saga")] Sagas sagas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sagas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sagas));
 }
示例#5
0
        public ActionResult Create([Bind(Include = "id_sagas,nombre_saga")] Sagas sagas)
        {
            if (ModelState.IsValid)
            {
                db.Sagas.Add(sagas);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sagas));
        }
示例#6
0
        public new void SetUp()
        {
            persister = new InMemorySagaPersister();
            FuncBuilder.Register <ISagaPersister>(() => persister);

            sagas = new Sagas();

            FuncBuilder.Register <SagaConfigurationCache>(() => sagas.sagaConfigurationCache);

            conventions = new Conventions();
        }
示例#7
0
        // GET: Sagas/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Sagas sagas = db.Sagas.Find(id);

            if (sagas == null)
            {
                return(HttpNotFound());
            }
            return(View(sagas));
        }
示例#8
0
        public async Task retrieve_should_load_saga_by_correlated_property()
        {
            // arrange
            var storedData = new ProcurementData()
            {
                Id = NewGuid(), OrderId = NewGuid()
            };
            var correlationProperty = new CorrelationProperty(Metadata.CorrelationProperty, storedData.OrderId, isDefaultValue: false);

            await Sagas.Store(storedData, correlationProperty, CancellationToken.None);

            // act
            var retrievedData = await Sagas.Retrieve <ProcurementData>(nameof( ProcurementData.OrderId ), storedData.OrderId, CancellationToken.None);

            // assert
            retrievedData.Should().BeEquivalentTo(storedData);
        }
示例#9
0
        public async Task retrieve_should_not_return_a_saga_marked_completed()
        {
            // arrange
            var storedData = new ProcurementData()
            {
                Id = NewGuid(), OrderId = NewGuid()
            };
            var correlationProperty = new CorrelationProperty(Metadata.CorrelationProperty, storedData.OrderId, isDefaultValue: false);

            await Sagas.Store(storedData, correlationProperty, CancellationToken.None);

            // act
            await Sagas.Complete(storedData, CancellationToken.None);

            var retrievedData = await Sagas.Retrieve <ProcurementData>(storedData.Id, CancellationToken.None);

            // assert
            retrievedData.Should().BeNull();
        }
示例#10
0
            /// <summary>
            /// Create a new database connection.
            /// </summary>
            /// <returns>A new, configured <see cref="DbConnection">database connection</see>.</returns>
            /// <exception cref="InvalidOperationException">The underlying configurations do not all use the same database connection string.</exception>
            public virtual DbConnection CreateConnection()
            {
                Contract.Ensures(Contract.Result <DbConnection>() != null);

                var connection = Messages.CreateConnection();
                var comparer   = StringComparer.OrdinalIgnoreCase;

                using (var connection2 = Events.CreateConnection())
                {
                    if (comparer.Equals(connection.ConnectionString, connection2.ConnectionString))
                    {
                        using (var connection3 = Sagas.CreateConnection())
                        {
                            if (comparer.Equals(connection.ConnectionString, connection3.ConnectionString))
                            {
                                return(connection);
                            }
                        }
                    }
                }

                throw new InvalidOperationException(SR.InvalidPersistenceConfiguration);
            }
示例#11
0
#pragma warning disable 1591 // Xml Comments
        public CommandResult Handle(Sagas.ISaga saga, ICommand command)
        {
            throw new NotImplementedException();
        }