public bool Equals(Field other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.FieldType, FieldType) && other.Id.Equals(Id) && Equals(other.Value, Value) && Equals(other.Name, Name); }
public IField CreateField(FieldTypeKey key, object value) { var fieldType = _fieldTypes.SingleOrDefault(ft => ft.Key == key); if (fieldType == null) { fieldType = new FieldType(key); } var field = new Field(fieldType); field.Value = value; return field; }
internal void Load(AccountDto accountDto) { Id = accountDto.Id; _provider = new Provider(accountDto.ProviderKey); foreach (var fieldDto in accountDto.Fields) { var field = new Field( new FieldType(fieldDto.FieldTypeKey.ToEnum<FieldTypeKey>()), fieldDto.Id, fieldDto.Name) { Value = fieldDto.Value }; _fields.Add(field); } foreach (var tagDto in accountDto.Tags) { Tags.Add(tagDto.Key); } Notes = accountDto.Notes; LastChangedUtc = accountDto.LastChangedUtc; SetClean(); }