Choosing the right version of GCP''s Datastore library for .Net Core

For GCP's Datastore I see two versions of Nuget, not sure what are the difference between, and which one to use when working with .Net Core applications

Google.Cloud.Datastore.V1
Google.Apis.Datastore.v1beta3

The second one does appears to be recently updated though while the sample application at https://cloud.google.com/datastore/docs/reference/libraries#client-libraries-install-csharp using the first one.

Jon Skeet
people
quotationmark

Disclaimer/authority: I'm the primary author of Google.Cloud.Datastore.V1, and I'm responsible for the Google Cloud Client Libraries for .NET. So I know what I'm talking about here, but I do have biases :)

You should really be picking between Google.Cloud.Datastore.V1 and Google.Apis.Datastore.v1 - there's no point in using a beta library at this point.

However, Google.Cloud.Datastore.V1 is the preferred library. The differences are:

  • Google.Apis.Datastore.v1 works over HTTP/1.1 with JSON payloads. Google.Cloud.Datastore.V1 uses gRPC and protocol buffer payloads.
  • Google.Apis.Datastore.v1 is entirely autogenerated, with our "old" code generation technology. It should work, but it's not as clean as the more recent code generation. Google.Cloud.Datastore.V1 is a mixture of generated code and hand-written code.

The part about the hand-written code is important - that's how we have classes like DatastoreTransaction which is more pleasant to work with than manually keeping track of the transaction ID etc. There are also a lot of conversions and extra methods on protobuf messages to make Datastore easier to work with.

Both libraries should work fine with .NET Core, but Google.Cloud.Datastore.V1 does require a gRPC native library, which currently only works with x86 and x64. Neither library is supported on UWP, Xamarin or Unity at the moment, but there may be some contexts where Google.Apis.Datastore.v1 works for you but the gRPC library doesn't. I would start off by trying to use Google.Cloud.Datastore.V1 though.

people

See more on this question at Stackoverflow