Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9225777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:39:53+00:00 2026-06-18T04:39:53+00:00

When I run update-datebase I get the following response: PM> update-database -verbose Using StartUp

  • 0

When I run update-datebase I get the following response:

PM> update-database -verbose

Using StartUp project ‘BestOrders’.

Using NuGet project ‘BestOrders’.

Specify the ‘-Verbose’ flag to view the SQL statements being applied to the target database.

Target database is: ‘Orders.sdf’ (DataSource: Orders.sdf, Provider: System.Data.SqlServerCe.4.0, Origin: Configuration).

No pending code-based migrations.

Running Seed method.

PM>

Now the seed method (the full code for which is given below) clearly runs becuase it takes a not insignificant amount of time but there is no data in the database. What am I missing?

Imports System
Imports System.Data.Entity
Imports System.Data.Entity.Migrations
Imports System.Linq

Namespace Migrations

    Friend NotInheritable Class Configuration 
        Inherits DbMigrationsConfiguration(Of OrdersContext)

        Public Sub New()
            AutomaticMigrationsEnabled = True
        End Sub

        Protected Overrides Sub Seed(context As OrdersContext)
            Const ItemCount As Integer = 100
            Const SupplierCount As Integer = 5
            Const PartsRequestCount As Integer = 25
            Const LocationsCount As Integer = 3
            Const MaxQuantity As Integer = 5
            Const Seed As Integer = 10
            Const DeliveryChance As Decimal = 0.5
            Dim Delivery() As Integer = {10, 90}
            Dim DiscChance(,) As Decimal = {{0.05, 0.07, 0.08},
                                           {0.025, 0.035, 0.05}}
            Dim PriceRange() As Decimal = {50, 5000} 'In cents!
            Dim Variance As Decimal = 10 'In percent
            Dim MultiSupplierChance = 0.66

            Dim rnd = New Random(Seed)

            For i = 1 To SupplierCount
                Dim sup = New Supplier With {.ID = i,
                                             .Name = String.Format("Supplier{0:D3}", i),
                                             .Delivery = IIf(rnd.NextDouble <= DeliveryChance,
                                                             rnd.Next(Delivery(0) / 10, Delivery(1) / 10) * 10,
                                                             0),
                                             .Discount = 0}

                Dim r = rnd.NextDouble
                For k = DiscChance.GetLowerBound(1) To DiscChance.GetUpperBound(1)
                    If r <= DiscChance(0, k) Then
                        sup.Discount = DiscChance(1, k)
                        Exit For
                    End If
                Next

                context.Suppliers.AddOrUpdate(sup)
            Next

            Dim j As Integer = 1
            For i = 1 To ItemCount
                Dim itm = New Item With {.ID = i,
                                         .Number = String.Format("Item{0:D4}", i),
                                         .SupplierItems = New List(Of SupplierItem)}
                Debug.Print("{0}: {1}", itm.ID, itm.Number)
                context.Items.AddOrUpdate(itm)
                Dim FirstSup = New SupplierItem With {.ID = j,
                                                      .Supplier = context.Suppliers.Find(rnd.Next(1, SupplierCount)),
                                                      .Price = rnd.Next(PriceRange(0), PriceRange(1)) * 100}

                j += 1
                itm.SupplierItems.Add(FirstSup)
                While rnd.NextDouble <= MultiSupplierChance And itm.SupplierItems.Count < SupplierCount
                    Dim NextSup = New SupplierItem With {.ID = j,
                                                         .Supplier = context.Suppliers.Find(rnd.Next(1, SupplierCount)),
                                                         .Price = FirstSup.Price + rnd.Next(-Variance, Variance) * 100}
                    If itm.SupplierItems.First(Function(s) s.Supplier.ID = NextSup.Supplier.ID) Is Nothing Then
                        j += 1
                        itm.SupplierItems.Add(NextSup)
                    End If
                End While

            Next

            For i = 1 To LocationsCount
                Dim loc = New Location With {.ID = i,
                                             .Name = String.Format("Location{0:D2}", i)}
                context.Locations.AddOrUpdate(loc)
            Next

            For i = 1 To PartsRequestCount
                Dim pr = New PartsRequest With {.ID = i,
                                                .Item = context.Items.Find(rnd.Next(1, ItemCount)),
                                                .Location = context.Locations.Find(rnd.Next(1, LocationsCount)),
                                                .Quantity = rnd.Next(1, MaxQuantity),
                                                .RequestTime = Now().AddMinutes(-rnd.Next(0, 10080))}
                context.PartsRequests.AddOrUpdate(pr)
            Next


            MyBase.Seed(context)
        End Sub

    End Class

End Namespace
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:39:54+00:00Added an answer on June 18, 2026 at 4:39 am

    I figured out the problem. I was forgetting to save the modified context.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try to run any update query in Access 2007, I get the
Good afternoon, I'm working on a project for my company to run an update
When I run python manage.py runserver I get the following error: Unhandled exception in
When I run: $ python manage.py syncdb I get the following output: Creating table
I'm using Elixir in a project that connects to a postgres database. I want
I want to do the following to my database: UPDATE Addresses SET Latitude =
I receive the following error when trying to run the new project per the
I'm trying to get the following SQL statement to work: UPDATE myschema.tableA update_tableA SET
so I run UPDATE x SET y = y + 1; where y is
When I try to run update a credit card type by passing in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.