本文整理汇总了C#中Microsoft.Isam.Esent.Interop.ColumnStream.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# ColumnStream.Flush方法的具体用法?C# ColumnStream.Flush怎么用?C# ColumnStream.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Isam.Esent.Interop.ColumnStream
的用法示例。
在下文中一共展示了ColumnStream.Flush方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSignature
public void AddSignature(string name, int level, Action<Stream> action)
{
using (var update = new Update(session, Signatures, JET_prep.Insert))
{
Api.SetColumn(session, Signatures, tableColumnsCache.SignaturesColumns["name"], name, Encoding.Unicode);
Api.SetColumn(session, Signatures, tableColumnsCache.SignaturesColumns["level"], level);
Api.SetColumn(session, Signatures, tableColumnsCache.SignaturesColumns["created_at"], DateTime.UtcNow);
using (var stream = new ColumnStream(session, Signatures, tableColumnsCache.SignaturesColumns["data"]))
using (var buffer = new BufferedStream(stream))
{
action(buffer);
buffer.Flush();
stream.Flush();
}
update.Save();
}
}
示例2: GetSignatureStream
public void GetSignatureStream(int id, int level, Action<Stream> action)
{
Api.JetSetCurrentIndex(session, Signatures, "by_id");
Api.MakeKey(session, Signatures, id, MakeKeyGrbit.NewKey);
Api.MakeKey(session, Signatures, level, MakeKeyGrbit.None);
if (Api.TrySeek(session, Signatures, SeekGrbit.SeekEQ) == false)
throw new InvalidOperationException("Could not find signature with id " + id + " and level " + level);
using (var stream = new ColumnStream(session, Signatures, tableColumnsCache.SignaturesColumns["data"]))
using (var buffer = new BufferedStream(stream))
{
action(buffer);
buffer.Flush();
stream.Flush();
}
}