Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TickerQ.Sample.WebApi.Migrations
{
/// <inheritdoc />
public partial class DbContextSync : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsEnabled",
schema: "ticker",
table: "CronTickers",
type: "INTEGER",
nullable: false,
defaultValueSql: "1");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsEnabled",
schema: "ticker",
table: "CronTickers");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("InitIdentifier")
.HasColumnType("TEXT");

b.Property<bool>("IsEnabled")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValueSql("1");

b.Property<byte[]>("Request")
.HasColumnType("BLOB");

Expand Down
3 changes: 2 additions & 1 deletion samples/TickerQ.Sample.WebApi/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using TickerQ.Dashboard.DependencyInjection;
using TickerQ.DependencyInjection;
using TickerQ.EntityFrameworkCore.DbContextFactory;
using TickerQ.EntityFrameworkCore.DependencyInjection;
Expand All @@ -21,6 +21,7 @@
b => b.MigrationsAssembly("TickerQ.Sample.WebApi"));
});
});
options.AddDashboard();
});

var app = builder.Build();
Expand Down
12 changes: 12 additions & 0 deletions samples/TickerQ.Sample.WebApi/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"profiles": {
"TickerQ.Sample.WebApi": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:55325;http://localhost:55329"
}
}
}
15 changes: 15 additions & 0 deletions samples/TickerQ.Sample.WebApi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### To have in consideration if something goes wrong with this sample project

- One of the errors that you might have is that the dashboard path gives you a 404. In this case, make that you firsst build the dashboard project.

Fixing instructions:
1. Make sure your terminal is located in the dashboard `wwwroot` path.
2. `npm install`
3. `npm run build`


- Another problem that you might have is related to EF migrations missing/out of date.
Fixing instructions:
1. Make sure your terminal is located in the dashboard `.WebApi` path.
2. `dotnet ef migrations add <migration-name>`. This makes sure that you have the latest version.
3. `dotnet ef database update`. This makes sure that the latest migration you've added is applied.
10 changes: 5 additions & 5 deletions samples/TickerQ.Sample.WebApi/TickerQ.Sample.WebApi.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(DotNetVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="$(DotNetVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="[10.0.0,11.0.0)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="[10.0.0,11.0.0)" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\TickerQ.SourceGenerator\TickerQ.SourceGenerator.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\src\TickerQ.Dashboard\TickerQ.Dashboard.csproj" />
<ProjectReference Include="..\..\src\TickerQ.SourceGenerator\TickerQ.SourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\src\TickerQ\TickerQ.csproj" />
<ProjectReference Include="..\..\src\TickerQ.EntityFrameworkCore\TickerQ.EntityFrameworkCore.csproj" />
</ItemGroup>
Expand Down
Loading