public override int Execute()
        {
            IConnection conn = null;
            try
            {
                conn = CreateConnection(_provider, _connstr);
                conn.Open();
            }
            catch (OSGeo.FDO.Common.Exception ex)
            {
                WriteException(ex);
                return (int)CommandStatus.E_FAIL_CONNECT;
            }

            if (Array.IndexOf<int>(conn.CommandCapabilities.Commands, (int)CommandType.CommandType_ListDataStores) < 0)
                return (int)CommandStatus.E_FAIL_UNSUPPORTED_CAPABILITY;

            using (FdoFeatureService service = new FdoFeatureService(conn))
            {
                ReadOnlyCollection<DataStoreInfo> datastores = service.ListDataStores(_FdoOnly);
                Console.WriteLine("Listing datastores:\n");
                foreach (DataStoreInfo dstore in datastores)
                {
                    Console.WriteLine("\n\tName:{0}\n\tDescription:{1}", dstore.Name, dstore.Description);
                }
            }

            conn.Close();
            return (int)CommandStatus.E_OK;
        }
Example #2
0
        public override int Execute()
        {
            IConnection conn = null;

            try
            {
                conn = CreateConnection(_provider, _connstr);
                conn.Open();
            }
            catch (OSGeo.FDO.Common.Exception ex)
            {
                WriteException(ex);
                return((int)CommandStatus.E_FAIL_CONNECT);
            }

            if (Array.IndexOf <int>(conn.CommandCapabilities.Commands, (int)CommandType.CommandType_ListDataStores) < 0)
            {
                return((int)CommandStatus.E_FAIL_UNSUPPORTED_CAPABILITY);
            }

            using (FdoFeatureService service = new FdoFeatureService(conn))
            {
                ReadOnlyCollection <DataStoreInfo> datastores = service.ListDataStores(_FdoOnly);
                Console.WriteLine("Listing datastores:\n");
                foreach (DataStoreInfo dstore in datastores)
                {
                    Console.WriteLine("\n\tName:{0}\n\tDescription:{1}", dstore.Name, dstore.Description);
                }
            }

            conn.Close();
            return((int)CommandStatus.E_OK);
        }
 private void GetDataStores()
 {
     using (FdoFeatureService service = _conn.CreateFeatureService())
     {
         ReadOnlyCollection <DataStoreInfo> dstores = service.ListDataStores(true);
         _view.DataStores     = dstores;
         _view.DestroyEnabled = (dstores.Count > 0) && canDestroy;
     }
 }