Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Entity Framework Core 6 Problem

Entity Framework Core 6 Problem

Scheduled Pinned Locked Moved C#
databasehelpasp-netsysadmin
24 Posts 3 Posters 82 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Dave Kreskowiak

    Change "public" to "dbo" in your code. Where did you find this tutorial you're following? The problem with Linq-To-Sql is that it is a dead product and no longer under development.

    Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
    Dave Kreskowiak

    K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #21

    OK, I think I have this now. I did the migration and update, and the DB was created and Department and Employee tables added. Next, I added a Companies entity, linked it to Departments, and ran

    dotnet ef migrations add AddCompanies
    dotnet ef database update

    and the Db is now up to date. So I need to run these 2 commands each time I make a change?

    If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

    D 1 Reply Last reply
    0
    • K Kevin Marois

      OK, I think I have this now. I did the migration and update, and the DB was created and Department and Employee tables added. Next, I added a Companies entity, linked it to Departments, and ran

      dotnet ef migrations add AddCompanies
      dotnet ef database update

      and the Db is now up to date. So I need to run these 2 commands each time I make a change?

      If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #22

      Yes. You can make a ton of changes and wrap them all in a single migration. Open the migration file and take a look at what's generated.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
      Dave Kreskowiak

      K 2 Replies Last reply
      0
      • D Dave Kreskowiak

        Yes. You can make a ton of changes and wrap them all in a single migration. Open the migration file and take a look at what's generated.

        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
        Dave Kreskowiak

        K Offline
        K Offline
        Kevin Marois
        wrote on last edited by
        #23

        OK, I get it now. That book I referenced doesn't show any of this, so far. Now I get why nothing was happening when I ran my console app. I was under the impression that creating the DBContext would do all of this

        If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

        1 Reply Last reply
        0
        • D Dave Kreskowiak

          Yes. You can make a ton of changes and wrap them all in a single migration. Open the migration file and take a look at what's generated.

          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
          Dave Kreskowiak

          K Offline
          K Offline
          Kevin Marois
          wrote on last edited by
          #24

          How do you get a Prod DB update to date with all the migration changes?

          If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups