I have ObjectModel that contains for example, 2 class Student and Course .
I want to use documentDB for save that 2 collection (one collection for courses and one for students) I need to create 2 diffrent collection in my documentDB DB ? , Or may I can use only one Collection?
Another problem when I want to convert from document to ObjectModel.Student , I don't want to use dynamic casting (real time performance issue).
public static async Task<ObjectModel.Student> GetGroupAsyncByID(string id)
{
try
{
Document document = await _client.ReadDocumentAsync(UriFactory.CreateDocumentUri(cDatabaseId, cAllCollections[0], id));
return (ObjectModel.Student)document; // compile error
}
catch (DocumentClientException e)
{
if (e.StatusCode == System.Net.HttpStatusCode.NotFound)
{
return null;
}
else
{
throw;
}
}
}
My Student Class
public class Student
{
#region Fields
[JsonProperty(PropertyName = "id")]
public string ID { get; set; }
public String StudentName { get; set; }
}
How I can cast from Doucment to Student object?
Thanks!