private void InitObjectStore() { // Does the file already exist? bool blobStoreExists = StoreSystem.StoreExists(ObjectStoreName); // If the blob store doesn't exist and we are read_only, we can't do // anything further so simply return. if (!blobStoreExists && IsReadOnly) { return; } // The blob store, // TODO: Support store-level configuration? if (blobStoreExists) { lobStore = StoreSystem.OpenStore(ObjectStoreName, new Configuration()); } else { lobStore = StoreSystem.CreateStore(ObjectStoreName, new Configuration()); } try { lobStore.Lock(); // TODO: have multiple BLOB stores LargeObjectStore = new LargeObjectStore(0, lobStore); // Get the 64 byte fixed area var fixedArea = lobStore.GetArea(-1, false); // If the blob store didn't exist then we need to create it here, if (!blobStoreExists) { long headerP = LargeObjectStore.Create(); fixedArea.Write(headerP); fixedArea.Flush(); } else { // Otherwise we need to initialize the blob store long headerP = fixedArea.ReadInt64(); LargeObjectStore.Open(headerP); } } finally { lobStore.Unlock(); } }
public void Dispose() { if (!IsClosed) { Close(); } if (lobStore != null) { lobStore.Dispose(); } if (stateStore != null) { stateStore.Dispose(); } if (tableSources != null) { foreach (var tableSource in tableSources) { tableSource.Value.Dispose(); } tableSources.Clear(); } if (StateStore != null) { StateStore.Dispose(); } if (LargeObjectStore != null) { LargeObjectStore.Dispose(); } if (tempStoreSystem != null) { tempStoreSystem.Dispose(); } tableSources = null; StateStore = null; tempStoreSystem = null; lobStore = null; Database = null; }