0
是否可以序列化CouchbaseClient
以將其寫入內存映射文件?序列化CouchbaseClient錯誤
當我嘗試這樣做:
[Serializable]
public class DocumentDatabaseConnection
{
public CouchbaseClient DocumentStoreConnection { get; set; }
}
static void main(string [] args)
{
CouchbaseClientConfiguration config = new CouchbaseClientConfiguration();
config.Urls.Add(new Uri("http://localhost:8091" + "/pools/"));
config.Bucket = "myBucket";
config.BucketPassword = "123456";
DocumentDatabaseConnection clientConnection = new DocumentDatabaseConnection();
clientConnection.DocumentStoreConnection = new CouchbaseClient(config);
try
{
//Here is where I try to convert it to a byte array to save in MMF
var myMMFObject = ObjectToByteArray(clientConnection);
WriteObjectToMMF("C:\\TEMP\\TEST.MMF", myMMFObject);
string myMMF = ReadObjectFromMMF("C:\\TEMP\\TEST.MMF").ToString();
}
catch(Exception e)
{
throw;
}
}
我得到一個SerializationException,爲Couchbase.CouchbaseClient。如果有可能序列化將如何完成。 Couchbase.CouchbaseClient通過NuGet安裝。
如何共享線程中的Couchbase.CouchbaseClient?