本文整理汇总了C#中EntityProperties.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# EntityProperties.ContainsKey方法的具体用法?C# EntityProperties.ContainsKey怎么用?C# EntityProperties.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityProperties
的用法示例。
在下文中一共展示了EntityProperties.ContainsKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EntityProperties_SerializedClass_CanConvertToEntityProperties
public void EntityProperties_SerializedClass_CanConvertToEntityProperties()
{
// Arrange
var expectedId = "SomeId";
var ob = new BasicEntity
{
Id = expectedId
};
var data = _serializer.PackSingleObject(ob);
// Act
var entityProperties = new EntityProperties(data);
var containsId = entityProperties.ContainsKey("Id");
string returnedId;
var isString = entityProperties["Id"].TryGet(out returnedId);
// Assert
Assert.True(containsId);
Assert.True(isString);
Assert.Equal(expectedId, returnedId);
}
示例2: GetPropertyValue
/// <summary>
/// Get the value of the specified property
/// </summary>
/// <param name="properties">property to search for</param>
/// <returns>value of the specified property</returns>
private string GetPropertyValue(string propertyName, EntityProperties properties)
{
// validate that an property name has been set
if (!properties.ContainsKey(propertyName))
{
throw new ArgumentNullException(propertyName, Globals.InputPropertyNotFound);
}
var objectName = properties[propertyName].ToString();
return objectName;
}
示例3: GetPluginName
/// <summary>
/// Get the table name form the passed in method input
/// </summary>
/// <param name="properties">the parameter values</param>
/// <returns>the name of the table to retrieve</returns>
private string GetPluginName(EntityProperties properties)
{
// validate that an object name has been set
if (!properties.ContainsKey("PluginName") || string.IsNullOrWhiteSpace(properties["PluginName"].ToString()))
{
throw new ArgumentNullException("PluginName", Globals.InputPropertyNotFound);
}
var objectName = properties["PluginName"].ToString();
return objectName;
}
示例4: GetLastSyncDate
/// <summary>
/// Get the last sync date from the passed in method input
/// </summary>
/// <param name="properties">>The parameters of the MethodInput.</param>
/// <returns>The last sync datetime of the table</returns>
private DateTime GetLastSyncDate(EntityProperties properties)
{
DateTime lastSyncDate = new DateTime();
DateTime minTime = new DateTime(1753, 1, 1);
// validate key exists and set its value
lastSyncDate = !properties.ContainsKey("LastSyncDate") ? minTime : Convert.ToDateTime(properties["LastSyncDate"]);
if (lastSyncDate < minTime)
{
lastSyncDate = minTime;
}
// log value
Logger.Write(Logger.Severity.Debug, Globals.ConnectorName, string.Format("LastSyncDate: {0}{1}", lastSyncDate, Environment.NewLine));
return lastSyncDate;
}
示例5: GetLastModifiedColumnNameFromInput
/// <summary>
/// Retrieve the column name used for checking the last date of synchronization on the column
/// </summary>
/// <param name="properties">The parameters of the MethodInput.</param>
/// <returns>string value of the column name</returns>
private string GetLastModifiedColumnNameFromInput(EntityProperties properties)
{
string columnName = string.Empty;
//check if the column name is specified by checking for the 'ModificationDateFullName' property
if (properties.ContainsKey("ModificationDateFullName"))
{
//set teh column name to the property in the property list
columnName = properties["ModificationDateFullName"].ToString();
}
return columnName;
}
示例6: ParsePropertyValue
/// <summary>
/// Get the value of a specific property
/// </summary>
/// <param name="propertyName">Name of the property to look for</param>
/// <param name="properties">list of properties of a column</param>
/// <param name="defaultValue">default value to set if the property is not found</param>
/// <returns>value of the property requested</returns>
private string ParsePropertyValue(string propertyName, EntityProperties properties, string defaultValue)
{
string propertyValue = string.Empty;
propertyValue = properties.ContainsKey(propertyName) == false ? defaultValue : properties[propertyName].ToString();
return propertyValue;
}