/// <summary> /// Define o valor da propriedade do perfil. /// </summary> /// <param name="propertyName"></param> /// <param name="propertyValue"></param> public void SetPropertyValue(string propertyName, object propertyValue) { ProfilePropertyDefinition propertyDefinition = null; if (!PropertyDefinitions.TryGetValue(propertyName, out propertyDefinition)) { throw new InvalidOperationException(string.Format("Not found property '{0}' for profile", propertyName)); } string value = null; if (propertyValue != null) { if (propertyValue is IConvertible) { value = ((IConvertible)propertyValue).ToString(System.Globalization.CultureInfo.InvariantCulture); } else { value = propertyValue.ToString(); } } ProfileProvider.SetProfilePropertyValue(this, propertyDefinition, value); lock (_properties) if (_properties.ContainsKey(propertyDefinition.Name)) { _properties[propertyDefinition.Name] = propertyValue; } else { _properties.Add(propertyDefinition.Name, propertyValue); } }