Quiz Study Guide

advertisement
1. What is “Seed data”?
2. Give one example of where having seed data might be
useful
3. In general, what three steps do you need to do in order to
automatically seed the database in ASP.Net MVC?
a. (I’m not looking for code, just a general description of
what you did in order to create the seed data)
4. In the tutorial you saw the following code:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
public static void Initialize(IServiceProvider serviceProvider)
{
var context = serviceProvider.GetService<ApplicationDbContext>();
if (context.Database == null)
{
throw new Exception("DB is null");
}
if (context.Movie.Any())
{
return;
// DB has been seeded
}
What is the purpose of lines 10-13?
Download