本文整理汇总了C#中Association.Serialize方法的典型用法代码示例。如果您正苦于以下问题:C# Association.Serialize方法的具体用法?C# Association.Serialize怎么用?C# Association.Serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Association
的用法示例。
在下文中一共展示了Association.Serialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XmlSimple
public void XmlSimple()
{
var assoc = new Association<int, string>(5, "aa");
var serialize = assoc.Serialize();
var newAssoc = ObjectExtensions.Deserialize<Association<int, string>>(serialize);
Assert.AreEqual(assoc.Key, newAssoc.Key);
Assert.AreEqual(assoc.Value, newAssoc.Value);
Assert.AreEqual(assoc, newAssoc);
}
示例2: SetAssociationCmd
protected override IDbCommand SetAssociationCmd(IDbTransaction txn, Uri serverUri, Association assoc)
{
MySqlCommand cmd = (MySqlCommand) this.connection.CreateCommand();
cmd.Transaction = txn;
cmd.CommandText = String.Format("REPLACE INTO {0} VALUES (@serverUrl, @handle, @serialized);", this.associationsTable);
MySqlParameter param;
param = cmd.Parameters.Add("@serverUrl", serverUri.AbsoluteUri);
param.DbType= DbType.String;
param = cmd.Parameters.Add("@handle", assoc.Handle);
param.DbType= DbType.String;
param = cmd.Parameters.Add("@serialized", assoc.Serialize());
param.DbType= DbType.Binary;
return cmd;
}