Skip to content

Commit

Permalink
repro app for #321
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsink committed Jun 3, 2020
1 parent 15e82d3 commit e8d8f8a
Show file tree
Hide file tree
Showing 9 changed files with 510 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test_nupkgs/issue321/AppDbContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;

namespace WpfAppSqliteTesting
{
public class AppDbContext : DbContext
{
#region PROPERTIES - ENTITIES
public DbSet<Entity> Entities { get; set; }
#endregion

#region CONSTRUCTORS
public AppDbContext(DbContextOptions<AppDbContext> options)
: base(options)
{
}
#endregion
}
}
24 changes: 24 additions & 0 deletions test_nupkgs/issue321/AppDbContextDesignTimeFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace WpfAppSqliteTesting
{
public class AppDbContextDesignTimeFactory
: IDesignTimeDbContextFactory<AppDbContext>
{
public AppDbContext CreateDbContext(string[] args)
{
// Init
var optionsBuilder = new DbContextOptionsBuilder<AppDbContext>();

optionsBuilder.UseSqlite($"Data Source=Test.db");

return new AppDbContext(optionsBuilder.Options);
}
}
}
98 changes: 98 additions & 0 deletions test_nupkgs/issue321/Entity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WpfAppSqliteTesting
{
public class Entity
{
#region PROPERTIES
// Event Log Identifier
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }

/// <summary>
/// </summary>
public long EventId { get; set; } = -1;

/// <summary>
/// </summary>
public int ClassId { get; set; } = -1;

/// <summary>
/// </summary>
public string ClassName { get; set; } = "";

/// <summary>
/// </summary>
public int GroupId { get; set; } = -1;

/// <summary>
/// </summary>
public string GroupName { get; set; } = "";

/// <summary>
/// </summary>
public string TechnicalComponentId { get; set; } = "";

/// <summary>
/// </summary>
public int StateId { get; set; } = -1;

/// <summary>
/// </summary>
public string StateName { get; set; } = "";

/// <summary>
/// Optional data
/// </summary>
public string Message { get; set; } = "";

/// <summary>
/// Optional data
/// </summary>
public string Parameter1 { get; set; } = "";

/// <summary>
/// Optional data
/// </summary>
public string Parameter2 { get; set; } = "";

/// <summary>
/// Optional data
/// </summary>
public string Parameter3 { get; set; } = "";

/// <summary>
/// Optional data
/// </summary>
public string Parameter4 { get; set; } = "";

/// <summary>
/// </summary>
public DateTime EventDateTime { get; set; }

/// <summary>
/// </summary>
public DateTime EventDateTimeUtc { get; set; }

/// <summary>
/// </summary>
public DateTime CreatedDateTimeUtc { get; set; } = DateTime.UtcNow;

/// <summary>
/// </summary>
public string CreatedBy { get; set; } = "";

/// <summary>
/// Message Id of the source message that was converted to this event
/// </summary>
public string SourceMessageId { get; set; } = "";
#endregion
}
}
88 changes: 88 additions & 0 deletions test_nupkgs/issue321/Migrations/20200603170627_Initial.Designer.cs

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

47 changes: 47 additions & 0 deletions test_nupkgs/issue321/Migrations/20200603170627_Initial.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace WpfAppSqliteTesting.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Entities",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
EventId = table.Column<long>(nullable: false),
ClassId = table.Column<int>(nullable: false),
ClassName = table.Column<string>(nullable: true),
GroupId = table.Column<int>(nullable: false),
GroupName = table.Column<string>(nullable: true),
TechnicalComponentId = table.Column<string>(nullable: true),
StateId = table.Column<int>(nullable: false),
StateName = table.Column<string>(nullable: true),
Message = table.Column<string>(nullable: true),
Parameter1 = table.Column<string>(nullable: true),
Parameter2 = table.Column<string>(nullable: true),
Parameter3 = table.Column<string>(nullable: true),
Parameter4 = table.Column<string>(nullable: true),
EventDateTime = table.Column<DateTime>(nullable: false),
EventDateTimeUtc = table.Column<DateTime>(nullable: false),
CreatedDateTimeUtc = table.Column<DateTime>(nullable: false),
CreatedBy = table.Column<string>(nullable: true),
SourceMessageId = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Entities", x => x.Id);
});
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Entities");
}
}
}
86 changes: 86 additions & 0 deletions test_nupkgs/issue321/Migrations/AppDbContextModelSnapshot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WpfAppSqliteTesting;

namespace WpfAppSqliteTesting.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.4");

modelBuilder.Entity("WpfAppSqliteTesting.Entity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");

b.Property<int>("ClassId")
.HasColumnType("INTEGER");

b.Property<string>("ClassName")
.HasColumnType("TEXT");

b.Property<string>("CreatedBy")
.HasColumnType("TEXT");

b.Property<DateTime>("CreatedDateTimeUtc")
.HasColumnType("TEXT");

b.Property<DateTime>("EventDateTime")
.HasColumnType("TEXT");

b.Property<DateTime>("EventDateTimeUtc")
.HasColumnType("TEXT");

b.Property<long>("EventId")
.HasColumnType("INTEGER");

b.Property<int>("GroupId")
.HasColumnType("INTEGER");

b.Property<string>("GroupName")
.HasColumnType("TEXT");

b.Property<string>("Message")
.HasColumnType("TEXT");

b.Property<string>("Parameter1")
.HasColumnType("TEXT");

b.Property<string>("Parameter2")
.HasColumnType("TEXT");

b.Property<string>("Parameter3")
.HasColumnType("TEXT");

b.Property<string>("Parameter4")
.HasColumnType("TEXT");

b.Property<string>("SourceMessageId")
.HasColumnType("TEXT");

b.Property<int>("StateId")
.HasColumnType("INTEGER");

b.Property<string>("StateName")
.HasColumnType("TEXT");

b.Property<string>("TechnicalComponentId")
.HasColumnType("TEXT");

b.HasKey("Id");

b.ToTable("Entities");
});
#pragma warning restore 612, 618
}
}
}
13 changes: 13 additions & 0 deletions test_nupkgs/issue321/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

This is a repro project for #321

It was originally provided by @jay1891

I have removed WPF, changed it to a command-line exe, and converted it to an SDK-style csproj with PackageReference.

By modifying the target framework in the csproj, it is easy to change back and forth between targeting netcore3.1 and net461.

When targeting netcore3.1, I have run the test several times and never seen it fail.

When targeting net461, I have run the test several times and never seen it succeed.

10 changes: 10 additions & 0 deletions test_nupkgs/issue321/issue321.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="microsoft.entityframeworkcore.sqlite" Version="3.1.4" />
<PackageReference Include="morelinq" Version="3.3.2" />
</ItemGroup>
</Project>
Loading

0 comments on commit e8d8f8a

Please sign in to comment.