private TikPropertyItem GetOrCreateItem(string propertyName) { TikPropertyItem result; if (!items.TryGetValue(propertyName, out result)) { result = new TikPropertyItem(); items.Add(propertyName, result); } return(result); }
/// <summary> /// Gets attribute <paramref name="propertyName"/> as bool (or returns /// null if does not exists). /// </summary> /// <param name="propertyName">Name of the single property.</param> /// <returns>Property value or null.</returns> public bool?GetAsBooleanOrNull(string propertyName) { TikPropertyItem item = GetOrCreateItem(propertyName); if (item.HasValue) { return(item.GetAsBool()); } else { return(null); } }
/// <summary> /// Gets attribute <paramref name="propertyName"/> as Int64 (or returns /// null if does not exists). /// </summary> /// <param name="propertyName">Name of the single property.</param> /// <returns>Property value or null.</returns> public long?GetAsInt64OrNull(string propertyName) { TikPropertyItem item = GetOrCreateItem(propertyName); if (item.HasValue) { return(item.GetAsInt64()); } else { return(null); } }
/// <summary> /// Gets attribute <paramref name="propertyName"/> as string (or returns /// null if does not exists). /// </summary> /// <param name="propertyName">Name of the single property.</param> /// <returns>Property value or null.</returns> public string GetAsStringOrNull(string propertyName) { TikPropertyItem item = GetOrCreateItem(propertyName); if (item.HasValue) { return(item.GetAsString()); } else { return(null); } }
/// <summary> /// Creates the new (attribute could not exists before) attribute value /// (<see cref="IsModified"/> of attribute is false). /// </summary> /// <param name="propertyName">Name of the single property.</param> /// <param name="value">The value.</param> public void CreatePropertyWithValue(string propertyName, string value) { TikPropertyItem item = new TikPropertyItem(value); items.Add(propertyName, item); }
/// <summary> /// Sets the attribute value (<see cref="IsModified"/> becomes true). /// </summary> /// <param name="propertyName">Name of the single property.</param> /// <param name="value">The value.</param> public void SetPropertyValue(string propertyName, bool?value) { TikPropertyItem item = GetOrCreateItem(propertyName); item.SetValue(value); }
/// <summary> /// Gets attribute <paramref name="propertyName"/> as Int64 (or returns /// default value if does not exists). /// </summary> /// <param name="propertyName">Name of the single property.</param> /// <returns>Property value or exception.</returns> /// <exception cref="InvalidOperationException">If property is not defined.</exception> public long GetAsInt64(string propertyName) { TikPropertyItem item = GetOrCreateItem(propertyName); return(item.GetAsInt64()); }
/// <summary> /// Gets attribute <paramref name="propertyName"/> as bool (or returns /// default value if does not exists). /// </summary> /// <param name="propertyName">Name of the single property.</param> /// <returns>Property value or exception.</returns> /// <exception cref="InvalidOperationException">If property is not defined.</exception> public bool GetAsBoolean(string propertyName) { TikPropertyItem item = GetOrCreateItem(propertyName); return(item.GetAsBool()); }
/// <summary> /// Gets attribute <paramref name="propertyName"/> as string (value must be set!). /// </summary> /// <param name="propertyName">Name of the single property.</param> /// <returns>Property value or exception.</returns> /// <exception cref="InvalidOperationException">If property is not defined.</exception> public string GetAsString(string propertyName) { TikPropertyItem item = GetOrCreateItem(propertyName); return(item.GetAsString()); }
public bool IsDataEqual(TikPropertyItem item) { return(object.Equals(item.itemValue, itemValue)); }