If the database classes lives in the same namespace as your Json
derived class,
then you only need to specify the class name.
If there is a code behind class (a partial class),
then you do not need to specify the DataType
property in the json-by-example file.
So it needs to be provided either in the .json file or in the (optional) code behind class.
person-viewmodel.json:
{
"FirstName":"Albert",
"LastName":"Einstein",
"Phonenumbers": [
{
"Type":"mobile"
"Number":"1234"
}
],
"$Phonenumbers":{"DataType":"MyDatabaseNamespace.Phonenumber"}
}
person-viewmodel.json.cs:
public class PersonViewModel : Json<Person> {
}
So if you only use the json-by-example file (no code behind), you will need to provide the bound database type:
person-message.json:
{
"$":{"DataType":"MyDatabaseNamespace.Person"},
"FirstName":"Albert",
"LastName":"Einstein",
"Phonenumbers": [
{
"Type":"mobile"
"Number":"1234"
}
],
"$Phonenumbers":{"DataType":"MyDatabaseNamespace.Phonenumber"}
}