Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

ismaelhamed avatar image
ismaelhamed asked joao.reis commented

Is there a way to enable/disable the schema metadata momentarily in the C# driver?

Is there a way to enable/disable the schema metadata momentarily, like with:

session.SetSchemaMetadataEnabled()

in the java driver? If not, what would be a proper alternative? Thanks.

csharp driver
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered joao.reis commented

[UPDATED] The equivalent method in the C# driver is SetMetadataSyncEnabled() provided by the MetadataSyncOptions API.

To disable metadata sync, set the value of MetadataSyncEnabled to false, for example:

var cluster = Cluster.Builder()
  .AddContactPoint("127.0.0.1")
  .WithMetadataSyncOptions(new MetadataSyncOptions().SetMetadataSyncEnabled(false))
  .Build();

To enable metadata sync, set the value of MetadataSyncEnabled to true, for example:

var cluster = Cluster.Builder()
  .AddContactPoint("127.0.0.1")
  .WithMetadataSyncOptions(new MetadataSyncOptions().SetMetadataSyncEnabled(true))
  .Build();

WARNING - Unlike SetSchemaMetadataEnabled() in the Java driver, you must invoke RefreshSchemaAsync() to force an update of the driver metadata.

For details, see Cluster and schema metadata in the C# driver. Cheers!

5 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Hi Erick. The question was whether that's doable in the C# driver.

0 Likes 0 ·
It wasn't clear from your original question that you were referring to the C# driver. I've updated my answer. Cheers!
1 Like 1 ·
ismaelhamed avatar image ismaelhamed Erick Ramirez ♦♦ ·
Thanks. I just wanted to make sure there's no way to do this (disable metadata -> update schema -> enable metadata again) from the same ISession using the csharp driver.
0 Likes 0 ·
Show more comments