Galen.Ci.EntityFramework.DbDeploymentManager.AnyVersionOfContextHasBeenDeployed C# (CSharp) Method

AnyVersionOfContextHasBeenDeployed() private method

private AnyVersionOfContextHasBeenDeployed ( ) : bool
return bool
        private bool AnyVersionOfContextHasBeenDeployed()
        {
            using (var targetContext = (DbContext)Activator.CreateInstance(InitializerInfo.ContextType))
            {
                targetContext.Database.Connection.ConnectionString =
                    m_ConnectionInfoBuilder.BuildConnectionString(m_Config.Database, m_Config.AuthMode, m_Config.SqlLogin, m_Config.SqlPassword);

                if (!targetContext.Database.Exists()) return false;

                try
                {
                    //Throws an exception if no model meta data is found,
                    //which is the case if the context hasn't been deloyed
                    targetContext.Database.CompatibleWithModel(true);
                }
                catch (NotSupportedException)
                {
                    return false;
                }

                return true;
            }
        }