public void ShouldBeSerializableAndParseable() { var value = RandomString(); HashedValue hashed = value; var copy = HashedValue.ParseFromHash(hashed.ToString()); Assert.AreEqual(hashed, copy); Assert.AreEqual(copy, value); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity <Account>() .Property(a => a.PasswordHash) .HasConversion(p => p.ToString(), p => HashedValue.ParseFromHash(p)); modelBuilder.Entity <Account>() .Property(a => a.Email) .HasConversion(p => p.ToString(), p => p); modelBuilder.Entity <NobreakState>() .HasIndex(s => s.Timestamp) .IsUnique(); }