Exemple #1
0
 protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
 {
     modelBuilder.Entity <Herb>(
         herb =>
     {
         herb.HasData(MatchQueryData.CreateHerbs());
         herb.HasKey(h => h.Id);
         herb.HasIndex(h => h.Name).IsFullText();
     });
 }
Exemple #2
0
            protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
            {
                modelBuilder.Entity <Herb>(
                    herb =>
                {
                    herb.HasData(MatchQueryData.CreateHerbs());
                    herb.HasKey(h => h.Id);
                    herb.HasIndex(h => new { h.Name }).IsFullText();
                    herb.HasIndex(h => new { h.Name, h.Garden }).IsFullText();

                    // We force a case-insensitive collation here, because there exists a bug, where MySQL and MariaDB will handle
                    // FULLTEXT searches for `..._bin` collations incorrectly.
                    herb.Property(h => h.Name).UseCollation(AppConfig.ServerVersion.DefaultUtf8CiCollation);
                    herb.Property(h => h.Garden).UseCollation(AppConfig.ServerVersion.DefaultUtf8CiCollation);
                });
            }