本文整理汇总了C#中DataObject.TryGet方法的典型用法代码示例。如果您正苦于以下问题:C# DataObject.TryGet方法的具体用法?C# DataObject.TryGet怎么用?C# DataObject.TryGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObject
的用法示例。
在下文中一共展示了DataObject.TryGet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RestoreState
public override void RestoreState(DataObject dob)
{
base.RestoreState(dob);
if (dob.ContainsKey("DelayAmount"))
DelayAmount = (string)dob["DelayAmount"];
if (dob.ContainsKey("CompletedDate"))
{
_actualExpiration = (DateTime) Convert.ChangeType(dob["CompletedDate"], typeof(DateTime));
}
dob.TryGet("ExpirationDate", ref _setExpiration);
}
示例2: RestoreState
/// <summary>
/// Restore process state from a DataObject (obtained by calling SaveProcessState).
/// This is the preferred way of storing process state in NGinn. Of course
/// process instance can be binary serialized and saved, but the binary format
/// causes problems when upgrading class versions.
/// </summary>
/// <param name="dob"></param>
public void RestoreState(DataObject dob)
{
if (this._activated) throw new ApplicationException("Restore is not possible after activation");
string v = (string) dob["APIVersion"];
if (!APIVERSION.Equals(v))
{
log.Warn("Trying to restore process state from version {0}. API version is {1}", v, APIVERSION);
}
DateTime dt = DateTime.MinValue;
_instId = (string) dob["InstanceId"];
_definitionId = (string) dob["ProcessDefinitionId"];
_status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), (string) dob["Status"]);
_persistedVersion = Convert.ToInt32(dob["PersistedVersion"]);
_startedBy = (string)dob["StartedBy"];
dob.TryGet("StartDate", ref _startDate);
if (dob.TryGet("FinishDate", ref dt)) FinishDate = dt;
DataObject vars = (DataObject)dob["InstanceData"];
_processInstanceData = new DataObject();
_processInstanceData["variables"] = vars;
_correlationId = (string)dob["CorrelationId"];
_transitionNumber = Convert.ToInt32(dob["TransitionNumber"]);
_currentMarking = new Dictionary<string, int>();
IList l = dob.GetArray("Marking");
if (l != null)
{
foreach (DataObject d2 in l)
{
string plid = (string)d2["Place"];
int n = Convert.ToInt32(d2["Tokens"]);
_currentMarking[plid] = n;
}
}
_activeTransitions = new Dictionary<string, TaskShell>();
IList l2 = dob.GetArray("Transition");
if (l2 != null)
{
foreach (DataObject dob2 in l2)
{
TaskShell ts = TaskShell.RestoreTaskShell(dob2);
_activeTransitions[ts.CorrelationId] = ts;
}
}
}
示例3: RestoreState
public override void RestoreState(DataObject dob)
{
base.RestoreState(dob);
if (!dob.TryGet("Url", ref _url)) throw new Exception("Missing Url");
}
示例4: RestoreState
public override void RestoreState(DataObject dob)
{
base.RestoreState(dob);
dob.TryGet("msgid", ref _msgid);
}
示例5: RestoreState
public override void RestoreState(DataObject dob)
{
base.RestoreState(dob);
if (!dob.TryGet("MessageCorrelationId", ref _messageCorrelationId)) throw new Exception("MessageCorrelationId required");
}
示例6: RestoreState
public override void RestoreState(DataObject dob)
{
base.RestoreState(dob);
Title = (string)dob["Title"];
Description = (string)dob["Description"];
AssigneeGroup = (string)dob["AssigneeGroup"];
AssigneeId = (string)dob["AssigneeId"];
CompletedBy = (string)dob["CompletedBy"];
dob.TryGet("CompletedDate", ref _completedDate);
}