simpleidserver / EFCore.Cassandra

Entity Framework Core provider for Cassandra
Apache License 2.0
35 stars 16 forks source link

Is there a way to use or pass the DefaultKeyspace during DbContext configuration? #16

Closed Delta-38 closed 3 years ago

Delta-38 commented 3 years ago

Hi everyone, I'm using EFCore.Cassandra (and liking it so far) to manage initialization and migrations on a cassandra cluster, but, despite the fairly straightforward tutorial, I ran into a couple of hurdles.

The first is one of configuration, even though in the option.UseCassandra method one can set default keyspace and connection options most of the actual model configuration methods require explicitly setting the Keyspace. For example Keyspace creation with the ForCassandraAddKeyspace, requires it explicitly and there doesn't seem to be an option to use the DefaultKeyspace provided to the UseCassandra method.

A similar occurrence happens with User Defined Types, where the schema / Keyspace has to be explicitly set.

This is an issue for me because the DbContext and the configuration are not in the same project, and I would rather not have to hardcode these settings.

Thanks in advance and I apologize if the functionality is there and I've simply missed it of course or if there's a quick workaround.

simpleidserver commented 3 years ago

Hi,

The default keyspace can be specified only one time. Please fetch the latest changes from the branch "release/2.0.4" and run the "EFCore.Cassandra.Samples" project. The default keyspace can be passed into the "UseCassandra" method.

Delta-38 commented 3 years ago

Ok, I can confirm that in 2.0.4 branch it works correctly. Looking forward to the release :)

simpleidserver commented 3 years ago

The release 2.0.4 is available.