Getting Started with Entity Framework Core [1 of 5]

Play Getting Started with Entity Framework Core [1 of 5]

The Discussion

  • User profile image
    Sunil Anthony

    Seems like EF Core 3.0 have a problem when doing a update-database. As you can see, it is missing the slash after the username.

    CREATE FILE encountered an operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:\Users\sunil.anthonyContosoPet.mdf

    Thank you,
    Sunil Anthony

  • User profile image
    Sunil Anthony

    Nevermind, I did some digging around and find out it was SQL 2017 MSSQL Local DB that had a bug and needed to be updated.

  • User profile image
    Jonathan Wood

    So, I see this was posted just last month. Yet, there are numerous changes between this video and the latest version of Visual Studio. For one thing, when I create a Razor Pages project, Entity Framework is already added to my project. (And NuGet has no Microsoft.EntityFrameworkCore.Design.) Also, when you created the data classes, it seemed like using statements for the data annotations namespaces were already added where I had to add them. There were a number of other differences too. And it would've been nice if you mentioned how to configure so that I can specify nullable strings and the like.

    .NET has been so fluid lately. Every time I come to build a new website, it seems like everything has changed again. So is anyone going to post a video like this for this month?

    Also, I started using computers around MS-DOS v1. There were no icons and commands had to be typed in. When Microsoft started adding the moniker "Visual" to everything it was to emphasize the point and click nature of those systems. So I find it interesting that progress now means I have to type commands into the console to build my database. I wonder if the current Visual Studio developers even know where the name Visual Studio moniker came from or what it meant.

  • User profile image

    And BTW, my personal take is that the EDMX file was waaaaay easier than all the hoops that need to be jumped through when using the new and "improved" version of .NET and EF.

  • User profile image
    @Sunil Anthony:

    This is a well-known problem. They are not fixing it because the bug is in SQL Server 2017.

    I overcame it easily by first creating the database. Look for the connection string (appsettings.json) and the database server is something like (localdb)\MSSQLLOCALDB. Go to SSMS or Object Explorer and connect to this server. Then create a brand new database with the same name in the connection string. You can take the opportunity to reduce the length of the name from its cryptic guid version.
  • User profile image
    Received the following error:

    Inconsistent accessibility: Property type order is less than "ProductOrder.Order". Has anyone received a similar error when going through the sample?
  • User profile image
    Is this guy trolling or what?
    Followed the steps & copied from his screen apart from the OnConfiguring override which I left out bc I have no connection string to use.

    Tried running Add-Migration and get rejected bc no database provider has been configured.

    Try to include the OnConfiguring override only to realize the database with connection string doesnt exist.

    Added a database as a .mdf and have no idea what im doing but got a connection string for it.

    Used this connection string to create the OnConfiguring override and was able to use the Add-Migration command.

    Now I have this weird .mdf file and no idea what to do next so I'm just rocking back and forth on the floor, cutting myself in the dark.
    Nice video though
  • User profile image

    Zero useful information.

Add Your 2 Cents