Ejemplo n.º 1
0
 private void RunEntity()
 {
     //var stopwatch = Stopwatch.StartNew();
     var correlationId = Guid.NewGuid().ToString();
     var parentRepository = new ParentEntityRepository();
     if (!parentRepository.Exists(correlationId))
     {
         var parent = new ParentEntity
         {
             CorrelationId = correlationId
         };
         parentRepository.Save(parent);
     }
     var entity = new Entity
     {
         CorrelationId = correlationId,
         Name = Guid.NewGuid().ToString(),
         StatusCode = 0
     };
     var entityRepository = new EntityRepository();
     entityRepository.Save(entity);
     //var tasks = new List<Task>();
     for (int i = 0; i < 15; i++)
     {
         var statusCode = i;
         var entityId = entity.Id;
         //tasks.Add(new Task(() => AddEvent(entityId, statusCode)));
         AddEvent(entityId, statusCode);
     }
     //tasks.ForEach(x => x.Start());
     //Task.WaitAll(tasks.ToArray());
     //Console.WriteLine("* Entity id: {0}, took: {1}ms", entity.Id, stopwatch.ElapsedMilliseconds);
 }
 private void RunEntity()
 {
     //var stopwatch = Stopwatch.StartNew();
     var correlationId = Guid.NewGuid().ToString();
     var parentRepository = new ParentEntityRepository();
     if (!parentRepository.Exists(correlationId))
     {
         var parent = new ParentEntity
         {
             CorrelationId = correlationId
         };
         parentRepository.Save(parent);
     }
     var entity = new Entity
     {
         CorrelationId = correlationId,
         Name = Guid.NewGuid().ToString(),
         StatusCode = 0
     };
     var entityRepository = new EntityRepository();
     entityRepository.Save(entity);
     var collection = entityRepository.GetCollection();
     for (int i = 0; i < 15; i++)
     {
         var statusCode = i;
         var entityId = entity.Id;
         AddEvent(entityId, statusCode, collection);
     }
     //Console.WriteLine("* Entity id: {0}, took: {1}ms", entity.Id, stopwatch.ElapsedMilliseconds);
 }
Ejemplo n.º 3
0
        private void RunEntity()
        {
            //var stopwatch = Stopwatch.StartNew();
            var correlationId    = Guid.NewGuid().ToString();
            var parentRepository = new ParentEntityRepository();

            if (!parentRepository.Exists(correlationId))
            {
                var parent = new ParentEntity
                {
                    CorrelationId = correlationId
                };
                parentRepository.Save(parent);
            }
            var entity = new Entity
            {
                CorrelationId = correlationId,
                Name          = Guid.NewGuid().ToString(),
                StatusCode    = 0
            };
            var entityRepository = new EntityRepository();

            entityRepository.Save(entity);
            var collection = entityRepository.GetCollection();

            for (int i = 0; i < 15; i++)
            {
                var statusCode = i;
                var entityId   = entity.Id;
                AddEvent(entityId, statusCode, collection);
            }
            //Console.WriteLine("* Entity id: {0}, took: {1}ms", entity.Id, stopwatch.ElapsedMilliseconds);
        }
        private void RunEntity()
        {
            //var stopwatch = Stopwatch.StartNew();
            var correlationId    = Guid.NewGuid().ToString();
            var parentRepository = new ParentEntityRepository();

            if (!parentRepository.Exists(correlationId))
            {
                var parent = new ParentEntity
                {
                    CorrelationId = correlationId
                };
                parentRepository.Save(parent);
            }
            var entity = new Entity
            {
                CorrelationId = correlationId,
                Name          = Guid.NewGuid().ToString(),
                StatusCode    = 0
            };
            var entityRepository = new EntityRepository();

            entityRepository.Save(entity);
            //var tasks = new List<Task>();
            for (int i = 0; i < 15; i++)
            {
                var statusCode = i;
                var entityId   = entity.Id;
                //tasks.Add(new Task(() => AddEvent(entityId, statusCode)));
                AddEvent(entityId, statusCode);
            }
            //tasks.ForEach(x => x.Start());
            //Task.WaitAll(tasks.ToArray());
            //Console.WriteLine("* Entity id: {0}, took: {1}ms", entity.Id, stopwatch.ElapsedMilliseconds);
        }