To illustrate a master/detail relationship in RavenDB, you will use the Countries
and the Cities
collections. Each Country
in the collection may have one or more related City
. Then you will create a new controller and two views in order to display a given Country
with all its related Cities
.
Open the
World
application, create a newController
class, select the Empty MVC Controller template, and name itCitiesPerCountryController
.Make sure the
CitiesPerCountryController
class inherits fromRavenBaseController
and modify it as follows:Right-click on the
Shared
folder, select Add View…, and create thePartialCities
view as follows:In the Add View dialog, check the Create a strongly typed-view option.
Choose the
City (World.Models)
class model.Select
List
as Scaffold Template.Make sure to check Create as a partial view.
Right-click on the
Index()
action method of theCitiesPerCountryController
class, select Add View… to create theIndex...