I create a simple insert operation to add the document to the server. My problem is the server has the id and empty content. I create all the staff by tutorial from Source code
this is source code
var document = new Document<Person>
{
Id = "P1",
Content = new Person
{
FirstName = "John",
LastName = "Adams",
Age = 21
}
};
var result = bucket.Insert(document);
if (result.Success)
{
Console.WriteLine("Inserted document '{0}'", document.Id);
}
that's mine (in a picture I show what I get in a server)
IBucket bucket = await ClusterHelper.GetBucketAsync("new_bucket");
var document = new Document<Person>
{
Id = "P1",
Content = new Person
{
Name = "John",
Surname = "Adams",
Age = 21
}
};
var result = await bucket.InsertAsync(document);
if (result.Success)
Console.WriteLine("Inserted document '{0}'", document.Id);
else
Console.WriteLine("Error this document exist");
I would like to know, Why it doesn't work with an object person? Why it saves empty content? (I take the example from source code, maybe I did something wrong?
Edit
public class Person
{
internal string Name { get; set; }
internal string Surname { get; set; }
internal int Age { get; set; }
}
Some interesting thing if I write the
var document = new Document<dynamic>
{
Id = "dynamic",
Content = new
{
Name = "John",
Surname = "Adams",
Age = 21
}
};
I take the content but it isn't comfortable( just my meaning)
Interesting but GET, UPDATE has the same problem. Get<Person>
always returns Null
value. WHY couchbase have that strange behavior?
Important
The problem with access modification internal
need to use only public! however why? does anyone have an idea?