I have a many to many relationship, like so
public class Movie
{
public int Id { get; set; }
public string Title { get; set; }
public int[] ActorIds { get; set; }
// etc
}
public class Actor
{
public int Id { get; set; }
public int Name { get; set; }
// etc
}
When I load a Movie, I also want to load all of the Actors associated with that Movie.
This can be done using Raven’s Load<T>(IEnumerable<System.ValueType> ids) method, and casting the int[] to an array of ValueType, like so:
var movie = RavenSession.Load<Movie>(movieId); var actorIds = movie.TabIds.Cast<System.ValueType>(); var actors = RavenSession.Load<Actor>(actorIds).OrderBy(x => x.Name);