protected override Domain BuildDomain(DomainConfiguration configuration)
        {
            Domain domain;

            try {
                //throw new ApplicationException("Don't validate, just recreate ;)");
                var validateConfig = configuration.Clone();
                validateConfig.UpgradeMode = DomainUpgradeMode.Validate;
                domain = Domain.Build(validateConfig);
            }
            catch (Exception ex) {
                var recreateConfig = configuration.Clone();
                recreateConfig.UpgradeMode = DomainUpgradeMode.Recreate;
                domain = base.BuildDomain(recreateConfig);
            }

            var shouldFill = false;

            using (var session = domain.OpenSession())
                using (var t = session.OpenTransaction()) {
                    var count = session.Query.All <Playlist>().Count();
                    if (count == 0)
                    {
                        shouldFill = true;
                    }
                }

            if (shouldFill)
            {
                DataBaseFiller.Fill(domain);
            }
            return(domain);
        }
Ejemplo n.º 2
0
        protected override Domain BuildDomain(DomainConfiguration configuration)
        {
            //var recreateConfig = configuration.Clone();
            var domain = Domain.Build(configuration);

            DataBaseFiller.Fill(domain);
            return(domain);
        }