Skip to content

Commit 5d059de

Browse files
update the database (#3)
1 parent 5b39d02 commit 5d059de

File tree

6 files changed

+3
-6
lines changed

6 files changed

+3
-6
lines changed

CS/BindToData.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ItemGroup>
88
<PackageReference Include="DevExpress.Blazor" Version="23.1.3" />
99
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
10-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />
10+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.4" />
1111
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.4">
1212
<PrivateAssets>all</PrivateAssets>
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

CS/Models/NorthwindContext.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ public NorthwindContext() {}
99
public NorthwindContext(DbContextOptions<NorthwindContext> options) : base(options) {}
1010
public virtual DbSet<Employee> Employees { get; set; }
1111
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
12-
if (!optionsBuilder.IsConfigured) {
13-
optionsBuilder.UseSqlServer("Server=.\\sqlexpress;Database=Northwind;Integrated Security=true");
14-
}
1512
}
1613
protected override void OnModelCreating(ModelBuilder modelBuilder) {
1714
modelBuilder.UseCollation("SQL_Latin1_General_CP1_CI_AS");

CS/Northwind.db

644 KB
Binary file not shown.

CS/Northwind.mdf

-5.19 MB
Binary file not shown.

CS/Northwind_log.ldf

-504 KB
Binary file not shown.

CS/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
});
1616
builder.Services.AddDbContextFactory<NorthwindContext>((sp, options) => {
1717
var env = sp.GetRequiredService<IWebHostEnvironment>();
18-
var dbPath = Path.Combine(env.ContentRootPath, "Northwind.mdf");
19-
options.UseSqlServer("Server=(localdb)\\MSSQLLocalDB;Integrated Security=true;AttachDbFileName=" + dbPath);
18+
var dbPath = Path.Combine(env.ContentRootPath, "Northwind.db");
19+
options.UseSqlite("DataSource=" + dbPath);
2020
});
2121
builder.WebHost.UseWebRoot("wwwroot");
2222
builder.WebHost.UseStaticWebAssets();

0 commit comments

Comments
 (0)