Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ardalis committed Nov 15, 2021
2 parents 0d5e4d1 + 2cc3a41 commit 426b34a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ Or if you're feeling really generous, we now support GitHub sponsorships - see t

## Versions

The master branch is now using .NET 5. If you need a previous version use one of these tagged commits:
The master branch is now using .NET 6. If you need a previous version use one of these tagged commits:

- [5.0](https://github.com/ardalis/CleanArchitecture/releases/tag/dotnet-core-5)
- [3.1](https://github.com/ardalis/CleanArchitecture/tree/dotnet-core-3.1)
- [2.2](https://github.com/ardalis/CleanArchitecture/tree/dotnet-core-2.2)
- [2.0](https://github.com/ardalis/CleanArchitecture/tree/dotnet-core-2.0)
Expand All @@ -61,9 +62,9 @@ The master branch is now using .NET 5. If you need a previous version use one of

To use this template, there are a few options:

- Install using `dotnet new` (preferred - see below)
- [Install the Visual Studio Template](https://marketplace.visualstudio.com/items?itemName=GregTrevellick.CleanArchitecture) and use it within Visual Studio
- Download this Repository
- Install using `dotnet new` (see below)

These are all covered below.

Expand Down
5 changes: 4 additions & 1 deletion src/Clean.Architecture.Web/SeedData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ public static void Initialize(IServiceProvider serviceProvider)
}
public static void PopulateTestData(AppDbContext dbContext)
{
foreach (var item in dbContext.Projects)
{
dbContext.Remove(item);
}
foreach (var item in dbContext.ToDoItems)
{
dbContext.Remove(item);
}
dbContext.SaveChanges();

TestProject1.Id = 1;
TestProject1.AddItem(ToDoItem1);
TestProject1.AddItem(ToDoItem2);
TestProject1.AddItem(ToDoItem3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class CustomWebApplicationFactory<TStartup> : WebApplicationFactory<TStar
protected override IHost CreateHost(IHostBuilder builder)
{
var host = builder.Build();
builder.ConfigureWebHost(ConfigureWebHost);
host.Start();

// Get service provider.
var serviceProvider = host.Services;
Expand All @@ -43,8 +43,12 @@ protected override IHost CreateHost(IHostBuilder builder)

try
{
// Can also skip creating the items
//if (!db.ToDoItems.Any())
//{
// Seed the database with test data.
SeedData.PopulateTestData(db);
SeedData.PopulateTestData(db);
//}
}
catch (Exception ex)
{
Expand All @@ -53,7 +57,6 @@ protected override IHost CreateHost(IHostBuilder builder)
}
}

host.Start();
return host;
}

Expand Down

0 comments on commit 426b34a

Please sign in to comment.