Ejemplo n.º 1
0
        /// <summary>
        /// Un-deploy feature
        /// </summary>
        public void UnDeployFeature(IDataFeature feature, string connectionStringName, System.Xml.XmlDocument configurationDom)
        {
            // Get the embedded resource
            try
            {
                String uninstallSql = feature.GetUnDeploySql(this.InvariantName),
                       checkSql     = feature.GetCheckSql(this.InvariantName);

                // Deploy the feature
                string connectionString = configurationDom.SelectSingleNode(String.Format("//connectionStrings/add[@name='{0}']/@connectionString", connectionStringName)).Value;
                NpgsqlConnectionStringBuilder builder = new NpgsqlConnectionStringBuilder(connectionString);
                builder.MaxPoolSize = 1;
                builder.MinPoolSize = 1;
                builder.Pooling     = false;
                NpgsqlConnection conn = new NpgsqlConnection(builder.ConnectionString);
                try
                {
                    conn.Open();

                    // Check for existing deployment
                    if (!String.IsNullOrEmpty(checkSql))
                    {
                        using (NpgsqlCommand cmd = new NpgsqlCommand(checkSql, conn))
                            if (!(bool)cmd.ExecuteScalar())
                            {
                                return;
                            }
                    }

                    // Uninstall
                    if (!String.IsNullOrEmpty(uninstallSql))
                    {
                        using (NpgsqlCommand cmd = new NpgsqlCommand(uninstallSql, conn))
                            cmd.ExecuteNonQuery();
                    }
                }
                finally
                {
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                throw;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Deploy the identified feature
 /// </summary>
 public bool Deploy(IDataFeature feature, string connectionStringName, SanteDBConfiguration configuration)
 {
     throw new NotSupportedException("This provider cannot be used in the Server Environment");
 }
 /// <summary>
 /// Deploy the specified feature
 /// </summary>
 public virtual bool Deploy(IDataFeature feature, string connectionStringName, SanteDBConfiguration configuration)
 {
     return(false);
 }