Exemple #1
0
        public void ShouldBeSerializableAndParseable()
        {
            var         value  = RandomString();
            HashedValue hashed = value;
            var         copy   = HashedValue.ParseFromHash(hashed.ToString());

            Assert.AreEqual(hashed, copy);
            Assert.AreEqual(copy, value);
        }
Exemple #2
0
        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();
        }