private IEnumerable <IWriteCommand> GenerateWriteCommands()
        {
            var entries = ChangeTracker.Entries();

            foreach (var entry in entries)
            {
                if (entry.State != EntityEntryState.NoChanges)
                {
                    yield return(EntityCommandBuilder.CreateCommand(entry));
                }
            }

            foreach (var command in CommandStaging.GetCommands())
            {
                yield return(command);
            }
        }
Exemplo n.º 2
0
        public void WriteFromStaging()
        {
            var connection = TestConfiguration.GetConnection();
            var pipeline   = new EntityWriterPipeline <TestModel>(connection);

            var entity = new TestModel
            {
                Title = "EntityWriterPipelineTests.WriteFromCollection"
            };
            var command = EntityCommandBuilder <TestModel> .CreateCommand(
                new EntityEntry <TestModel>(entity, EntityEntryState.Added)
                );

            pipeline.StageCommand(command);
            pipeline.Write();

            Assert.IsNotNull(entity.Id);
        }