public class MovieRole
{
public string RoleName { get; set; }
public string Description { get; set; }
public Link Person { get; set; }
}
CSHARP
1
2
3
4
5
// Access the director field data using the generic type
MovieRole directorRole = movieEntry.Get<MovieRole>("director");
// The Person entry link can be accessed
Link director = directorRole.Person;
CSHARP
1
2
3
4
5
// Alternatively return a dynamic object
dynamic directorRole = movieEntry.Get("director");
// The Person entry link can be accessed
Link director = directorRole.Person;
CSHARP
1
2
3
4
5
6
7
8
9
// Access the actors field data using the generic type
List<MovieRole> actorRoles = movieEntry.Get<List<MovieRole>>("actors");
foreach(MovieRole role in actorRoles)
{
// The Person entry id can be accessed and updated
int actorId = role.Person.Id;
...
}
Setting component data
CSHARP
1
2
3
4
5
6
7
8
9
10
11
Movie directorRole = new MovieRole
{
RoleName = "Director",
Description = "Debut directing position for this Marvel block buster",
Person = new Link("566779e5-3b3d-439f-aa45-957ae21f17ed")
};
movieEntry.Set("director", directorRole);
// Commit the changes
movieEntry.Save();
CSHARP
1
2
3
4
5
6
7
8
9
10
11
var directorRole = new
{
RoleName = "Director",
Description = "Debut directing position for this Marvel block buster",
Person = new Link("566779e5-3b3d-439f-aa45-957ae21f17ed")
};
movieEntry.Set("director", directorRole);
// Commit the changes
movieEntry.Save();