Reputation: 38
I am new to google cloud datastore and trying to access 'KIND' and save to with C#. I have searched the documentation available on google cloud but did not find how to access data on google datastore and save to. I am able to authenticate.
There is proper documentation for JAVA, NODE.JS, GO and PYTHON but not for .NET. Please help.
Upvotes: 2
Views: 2873
Reputation: 1889
The actual API Reference is almost impossible to find. I eventually tracked it down here: https://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Datastore.V1/api/Google.Cloud.Datastore.V1.DatastoreDb.html#Google_Cloud_Datastore_V1_DatastoreDb_Create_System_String_System_String_Google_Cloud_Datastore_V1_DatastoreClient_
Hopefully this helps someone looking for all of the documentation.
Upvotes: 0
Reputation: 3591
I've wrote a mini .NET ORM for the Google Datastore: https://github.com/NoGame/GoogleDatastoreORM
You might find it useful.
Upvotes: 2
Reputation: 3443
Yes, you can totally use C# to access google cloud datastore.
This sample shows you how: https://cloud.google.com/dotnet/getting-started/using-cloud-datastore Here's a direct link to the code: https://github.com/GoogleCloudPlatform/getting-started-dotnet/blob/master/aspnet/2-structured-data/Models/DatastoreBookStore.cs
To search by Kind:
var query = new Query()
{
Limit = pageSize,
Kinds = new[] { new KindExpression() { Name = "Book" } },
};
To create a Key with the specified Kind:
public static Key ToKey(this long id)
{
return new Key()
{
Path = new KeyPathElement[]
{
new KeyPathElement() { Kind = "Book", Id = (id == 0 ? (long?)null : id) }
}
};
}
More documentation is coming soon.
Upvotes: 3