我想将沙发数据库精简版用于我正在使用.NET开发目标窗口的应用程序我使用nuget安装了沙发精简版1.1.0.1。 我面临着多个问题, 1.当我尝试阅读文档时保存文档后,当我尝试阅读文档时,主要是出现错误。这是例外
Database: Error getting doc numeric id
System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.YieldInternal()
at System.Threading.Tasks.Task.SpinWait(Int32 millisecondsTimeout)
at System.Threading.Tasks.Task.SpinThenBlockingWait(Int32 millisecondsTim
eout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.InternalWait(Int32 millisecondsTimeout, Ca
ncellationToken cancellationToken)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNoti
fication)
at System.Threading.Tasks.Task`1.get_Result()
at Couchbase.Lite.SqlitePCLRawStorageEngine.RawQuery(String sql, Object[]
paramArgs)
at Couchbase.Lite.SqlitePCLRawStorageEngine.IntransactionRawQuery(String
sql, Object[] paramArgs)
at Couchbase.Lite.Database.GetDocNumericID(String docId)
我的代码是
public class CouchliteBaseRepository
{
Manager _manager;
Database _db;
public CouchliteBaseRepository()
{
_manager = new Manager(new System.IO.DirectoryInfo(@"D:\
Client\Test.ClientStartup\bin\Debug"), Manager.DefaultOptions);
_db = _manager.GetDatabase("couchorderdb");
}
public void UpdateData(string key, Dictionary<string, object> dt)
{
_db = _manager.GetDatabase("couchorderdb");
var document = _db.GetExistingDocument(key);
if (document == null)
document = _db.GetDocument(key);
else
dt.Add("_rev", document.CurrentRevisionId);
var rev = document.PutProperties(dt);
//_manager.Close();
}
public void GetData(string key)
{
// _db = _manager.GetDatabase("couchorderdb");
var document = _db.GetExistingDocument(key);
var revid = document.CurrentRevisionId;
// doc.Purge();
var data = document.UserProperties;
_manager.Close();
Console.Write("tt");
}
}
我在文档中调用UpdateDatato设置数据 然后调用GetData传递密钥,我在这里遗漏了什么吗? 我使用的密钥如下
couchlite.UpdateData(string.Format("{0:yyyy-MMddHH}", DateTime.Now),
bulkdata);