EntityFramework.Docs icon indicating copy to clipboard operation
EntityFramework.Docs copied to clipboard

Missing Prerequisites

Open JSPayne001 opened this issue 1 year ago • 4 comments

Type of issue

Missing information

Description

[Enter feedback here] At the start of the web page, there is a paragraph that gives the prerequisites for the tutorial that is provided. He correctly states that one needs Visual Studio, but fails to mention that one also needs to have SQLite installed. Or the other option is int the body of the tutorial is to make reference to other databases that can be used such as SQL Server Express, etc.

This issue is also present on the web form https://learn.microsoft.com/en-us/ef/core/get-started/winforms.

Page URL

https://learn.microsoft.com/en-us/ef/core/get-started/winforms

Content source URL

https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/get-started/winforms.md

Document Version Independent Id

ed8b20d5-5fe5-a2c9-e024-8c24ff0846a1

Article author

@ajcvickers

JSPayne001 avatar Jun 09 '24 11:06 JSPayne001

@JSPayne001 Can you explain more what you mean by, "have SQLite installed?" What did you have to "install" and how?

ajcvickers avatar Jun 09 '24 11:06 ajcvickers

I have referenced the wrong web page. The page I’m looking at is https://learn.microsoft.com/en-us/ef/core/get-started/overview/first-app?tabs=visual-studio

If you follow the instructions down to the section “Create The Database” and run the commands in the power shell script, the command “Add-Migration InitialCreate” and the Command “Update-Database” both return an error message “Build Failed”. With some tested I found that it failed because I do not have SQLite install on my local computer.

I was able to change the connection string that the reverse engineer generated in the previous step to point to my installed SQL Server Express and then the commands ran properly created a database in SQL Server Express.

JSPayne001 avatar Jun 09 '24 20:06 JSPayne001

@JSPayne001 By default, SQLite does not require installation. The binary is delivered in the package and is deployed locally. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.

ajcvickers avatar Jun 10 '24 08:06 ajcvickers

Arthur,

This is the code that I copied from the web page for the class BloggingContext:

public class BloggingContext : DbContext

{

public DbSet<Blog> Blogs { get; set; }

public DbSet<Post> Posts { get; set; }



public string DbPath { get; }



public BloggingContext()

{

    var folder = Environment.SpecialFolder.LocalApplicationData;

    var path = Environment.GetFolderPath(folder);

    DbPath = System.IO.Path.Join(path, "blogging.db");

}



// The following configures EF to create a Sqlite database file in the

// special "local" folder for your platform.

protected override void OnConfiguring(DbContextOptionsBuilder options)

            => options.UseSqlite($"Data Source={DbPath}");

}

The next step on the web page is Create the Database using Package Manager Control

The result of that operation was

I changed the line above =>options.UseSqlite($"Data Source={DbPath}");

To =>options.UseSqlServer("Server=Raven\SqlExpress;Database=Blog;TrustServerCertificate=True;Integrated Security=True;"); and this was the result.

I am running Windows 11 Home Version 23H2 with OS build 22631.3672 and Visual Studio Community 2022 (64-bit) Version 17.10.1. The application was built as a console application with target framework .NET 8.0

From: Arthur Vickers @.> Sent: Monday, June 10, 2024 4:32 AM To: dotnet/EntityFramework.Docs @.> Cc: JSPayne001 @.>; Mention @.> Subject: Re: [dotnet/EntityFramework.Docs] Missing Prerequisites (Issue #4741)

@JSPayne001 https://github.com/JSPayne001 By default, SQLite does not require installation. The binary is delivered in the package and is deployed locally. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.

— Reply to this email directly, view it on GitHub https://github.com/dotnet/EntityFramework.Docs/issues/4741#issuecomment-2157703603 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BH67HP2YNWGJ5LIA4DMCJ6DZGVP65AVCNFSM6AAAAABJAZYF7CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJXG4YDGNRQGM . You are receiving this because you were mentioned. https://github.com/notifications/beacon/BH67HPZMTFYGB4KCEZQIOJ3ZGVP65A5CNFSM6AAAAABJAZYF7CWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUATPY3G.gif Message ID: @.*** @.***> >

JSPayne001 avatar Jun 10 '24 11:06 JSPayne001