示例#1
0
 public void UploadLocalLayer(string workspaceId, string id)
 {
     if (HasLayer(workspaceId, id))
     {
         _tileStorage.Store($"{workspaceId}/{id}.mbtiles", _tileCache.GetFilePath(workspaceId, id));
     }
 }
示例#2
0
        private SqliteConnection GetConnection(bool writable = false)
        {
            if (Id == null)
            {
                return(null);
            }
            var builder = new SqliteConnectionStringBuilder
            {
                Mode       = writable ? SqliteOpenMode.ReadWrite : SqliteOpenMode.ReadOnly,
                Cache      = SqliteCacheMode.Private,
                DataSource = _tileCache.GetFilePath(WorkspaceId, Id)
            };
            var connStr = builder.ConnectionString;

            try
            {
                var dbConnection = new SqliteConnection(connStr);
                dbConnection.Open();
                return(dbConnection);
            }
            catch (Exception e)
            {
                throw new Exception($"Failed to open database for service {Id} (connection string={connStr}) exception={e}", e);
            }
        }