本文整理汇总了C#中IField.Serialize方法的典型用法代码示例。如果您正苦于以下问题:C# IField.Serialize方法的具体用法?C# IField.Serialize怎么用?C# IField.Serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IField
的用法示例。
在下文中一共展示了IField.Serialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateField
/// <summary>
/// Rewrites the properties of a given field in the database.
/// </summary>
/// <param name="field"></param>
private void UpdateField(IField field)
{
driver.query("UPDATE fields SET content = ", field.Serialize(), " WHERE id_field = ", field.FieldId);
}
示例2: AddField
/// <summary>
/// Saves a new field to the databse (must have null ID, which will be set to the AI from the database).
/// </summary>
/// <param name="field"></param>
public void AddField(IField field)
{
// fieldId = 0
Dictionary<string, object> insertVals = new Dictionary<string,object>();
insertVals["id_panel"] = field.PanelId;
insertVals["content"] = field.Serialize();
if (!driver.IsInTransaction)
{
driver.BeginTransaction();
driver.query("INSERT INTO fields", dbe.InsVals(insertVals));
field.SetId(driver.LastId()); // must be 0 in creation
driver.CommitTransaction();
}
else {
driver.query("INSERT INTO fields", dbe.InsVals(insertVals));
field.SetId(driver.LastId()); // must be 0 in creation
}
}