Ejemplo n.º 1
0
        public static void InitializerWithDefaultValuesIfEmpty(IDocumentStore documentStore)
        {
            using (var session = documentStore.OpenSession())
            {
                if (!session.Query<Environment>().Any())
                {
                    var e1 = new Environment() { Id = 1, Name = "DEV", Description = "Development environment for the Dev's" };
                    var e2 = new Environment() { Id = 2, Name = "TEST", Description = "Dedicated environment for tester." };
                    var e3 = new Environment() { Id = 3, Name = "PROD", Description = "Production." };
                    var e4 = new Environment() { Id = 4, Name = "unittest", Description = "unit tests" };

                    session.Store(e1);
                    session.Store(e2);
                    session.Store(e3);
                    session.Store(e4);

                    session.SaveChanges();
                }

                if (session.Load<ServerSettings>("ServerSettings/1") == null)
                {
                    session.Store(new ServerSettings()
                    {
                        Id = 1,
                        WorkDir = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "PowerDeploy.UnitTests")
                    });

                    session.SaveChanges();
                }
            }
        }
        public static DeploymentDto ToDto(this Deployment_Latest.ReducedResult from, Environment environment)
        {
            var to = from.ConvertTo<DeploymentDto>();
            to.Environment = environment.ToDto();

            return to;
        }
        public static DeploymentDto ToDto(this Deployment from, Environment environment)
        {
            var to = from.ConvertTo<DeploymentDto>();
            to.Environment = environment.ToDto();
            to.Package = from.Package.ToDto();

            //var to = from.ConvertTo<MyDto>();
            //to.Items = from.Items.ConvertAll(x => x.ToDto());
            //to.CalculatedProperty = Calculate(from.Seed);
            return to;
        }
Ejemplo n.º 4
0
        private void CreateEnvironments(IDocumentStore store)
        {
            var e1 = new PowerDeploy.Server.Model.Environment()
            {
                Id = (int)Environment.Dev, Name = "DEV", Order = 1
            };
            var e2 = new PowerDeploy.Server.Model.Environment()
            {
                Id = (int)Environment.Test, Name = "TEST", Order = 2
            };
            var e3 = new PowerDeploy.Server.Model.Environment()
            {
                Id = (int)Environment.Prod, Name = "PROD", Order = 3
            };

            using (var session = store.OpenSession())
            {
                session.Store(e1);
                session.Store(e2);
                session.Store(e3);

                session.SaveChanges();
            }
        }
Ejemplo n.º 5
0
        private void CreateEnvironments(IDocumentStore store)
        {
            var e1 = new PowerDeploy.Server.Model.Environment() { Id = (int)Environment.Dev, Name = "DEV" , Order = 1};
            var e2 = new PowerDeploy.Server.Model.Environment() { Id = (int)Environment.Test, Name = "TEST", Order = 2 };
            var e3 = new PowerDeploy.Server.Model.Environment() { Id = (int)Environment.Prod, Name = "PROD", Order = 3 };

            using (var session = store.OpenSession())
            {
                session.Store(e1);
                session.Store(e2);
                session.Store(e3);

                session.SaveChanges();
            }
        }