internal BLOB(Table table, Stream source) { _table = table; _bfs = table.Database.BlobFS; int handle; _bfs.Lock(); try { Stream stream = _bfs.AllocFile(out handle).BaseStream; _id = handle.ToString(); SetStream(source, stream); } finally { _bfs.UnLock(); } }
public void AddSingleFile() { const int count = 100000; int handle; BinaryWriter file = _bfs.AllocFile(out handle); Assert.IsTrue(handle > 0); for (int i = 0; i < count; ++i) { file.Write(i.ToString()); } _bfs.Dispose(); _bfs = null; Assert.IsTrue(new FileInfo(_bfsFile).Length > count * 2); }