Esempio n. 1
0
        public override int Execute()
        {
            IConnection conn = null;

            try
            {
                conn = FeatureAccessManager.GetConnectionManager().CreateConnection(_provider);
            }
            catch (OSGeo.FDO.Common.Exception ex)
            {
                WriteException(ex);
                return((int)CommandStatus.E_FAIL_CREATE_CONNECTION);
            }

            if (Array.IndexOf <int>(conn.CommandCapabilities.Commands, (int)OSGeo.FDO.Commands.CommandType.CommandType_DestroyDataStore) < 0)
            {
                Console.Error.WriteLine("This provider does not support destroying data stores");
                return((int)CommandStatus.E_FAIL_UNSUPPORTED_CAPABILITY);
            }

            using (IDestroyDataStore destroy = conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_DestroyDataStore) as IDestroyDataStore)
            {
                IDataStorePropertyDictionary dict = destroy.DataStoreProperties;
                Console.WriteLine("Data Store Properties:");
                WriteProperties(dict);
            }

            if (conn.ConnectionState != ConnectionState.ConnectionState_Closed)
            {
                conn.Close();
            }
            return((int)CommandStatus.E_OK);
        }
 public void DestroyDataStore(NameValueCollection props)
 {
     using (FdoFeatureService service = _conn.CreateFeatureService())
     {
         using (IDestroyDataStore destroy = service.CreateCommand <IDestroyDataStore>(CommandType.CommandType_DestroyDataStore))
         {
             foreach (string key in props.AllKeys)
             {
                 destroy.DataStoreProperties.SetProperty(key, props[key]);
             }
             destroy.Execute();
         }
     }
 }