@@ -10,17 +10,16 @@ namespace EFCore.Cassandra.Samples
1010{
1111 public class FakeDbContext : DbContext
1212 {
13- private const string CV_KEYSPACE = "cv" ;
1413 public DbSet < Applicant > Applicants { get ; set ; }
1514
1615 protected override void OnConfiguring ( DbContextOptionsBuilder optionsBuilder )
1716 {
18- optionsBuilder . UseCassandra ( $ "Contact Points=127.0.0.1", CV_KEYSPACE , opt =>
17+ optionsBuilder . UseCassandra ( "Contact Points=127.0.0.1; " , "cv" , opt =>
1918 {
20- opt . MigrationsHistoryTable ( HistoryRepository . DefaultTableName , CV_KEYSPACE ) ;
21- } , b =>
22- {
23- b . WithQueryOptions ( new QueryOptions ( ) . SetConsistencyLevel ( ConsistencyLevel . LocalOne ) )
19+ opt . MigrationsHistoryTable ( HistoryRepository . DefaultTableName ) ;
20+ } , o => {
21+
22+ o . WithQueryOptions ( new QueryOptions ( ) . SetConsistencyLevel ( ConsistencyLevel . LocalOne ) )
2423 . WithReconnectionPolicy ( new ConstantReconnectionPolicy ( 1000 ) )
2524 . WithRetryPolicy ( new DefaultRetryPolicy ( ) )
2625 . WithLoadBalancingPolicy ( new TokenAwarePolicy ( Policies . DefaultPolicies . LoadBalancingPolicy ) )
@@ -39,9 +38,9 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
3938 protected override void OnModelCreating ( ModelBuilder modelBuilder )
4039 {
4140 var timeUuidConverter = new TimeUuidToGuidConverter ( ) ;
42- modelBuilder . ForCassandraAddKeyspace ( CV_KEYSPACE , new KeyspaceReplicationSimpleStrategyClass ( 2 ) ) ;
41+ modelBuilder . EnsureKeyspaceCreated ( new KeyspaceReplicationSimpleStrategyClass ( 2 ) ) ;
4342 modelBuilder . Entity < Applicant > ( )
44- . ToTable ( "applicants" , CV_KEYSPACE )
43+ . ToTable ( "applicants" )
4544 . HasKey ( p => new { p . Id , p . Order } ) ;
4645 modelBuilder . Entity < Applicant > ( )
4746 . ForCassandraSetClusterColumns ( _ => _ . Order )
@@ -52,11 +51,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
5251 modelBuilder . Entity < Applicant > ( )
5352 . Property ( p => p . Id )
5453 . HasColumnName ( "id" ) ;
55- modelBuilder . Entity < CV > ( )
56- . ToTable ( "cvs" , CV_KEYSPACE )
57- . HasKey ( c => c . Id ) ;
5854 modelBuilder . Entity < ApplicantAddress > ( )
59- . ToUserDefinedType ( "applicant_addr" , CV_KEYSPACE )
55+ . ToUserDefinedType ( "applicant_addr" )
6056 . HasNoKey ( ) ;
6157 }
6258 }
0 commit comments