/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
private static Dictionary <string, PropertyInfo> GetEntityPerpertiesInfoList <TType>(string entityFullName) where TType : new() { if (EntityProperties.ContainsKey(entityFullName)) { return(EntityProperties[entityFullName]); } var piList = new Dictionary <string, PropertyInfo>(); var props = typeof(TType).GetTypeInfo().GetProperties(BindingFlags.Instance | BindingFlags.Public); foreach (var prop in props) { piList.Add(prop.Name.ToLower(), prop); } EntityProperties.Add(entityFullName, piList); return(piList); }
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); }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }