# 1.3.4.Seeding the database

\--

* 1.After we add a new class and add-migration and update-database, we got a empty table, now we use migration to insert value to table, Type:

  ```
    `add-migration populateMembershipTypes`
  ```
* 2.Modify the file generated in \~/Migrations, type some SQL statements:

```
        namespace Vidly2.Migrations
        {
            using System;
            using System.Data.Entity.Migrations;

            public partial class populateMemnershipTypes : DbMigration
            {
                public override void Up()
                {
                    Sql("INSERT INTO MembershipTypes (Id, SignUpFee, DurationInMonth, DiscountRate) VALUES (1, 0, 0, 0)");
                    Sql("INSERT INTO MembershipTypes (Id, SignUpFee, DurationInMonth, DiscountRate) VALUES (2, 30, 1, 10)");
                    Sql("INSERT INTO MembershipTypes (Id, SignUpFee, DurationInMonth, DiscountRate) VALUES (3, 90, 3, 15)");
                    Sql("INSERT INTO MembershipTypes (Id, SignUpFee, DurationInMonth, DiscountRate) VALUES (4, 300, 12, 20)");
                }

                public override void Down()
                {
                }
            }
        }
```

* 3.Update database:

  ```
    `update-database`
  ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jen-hsuan-hsieh.gitbook.io/asp-net/chapter1/1.1.the-complete-asp.net-mvc-5-course/13working-with-data/135seeding-the-database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
