Skip to content

Commit

Permalink
Added a SchematicName column in EF provider for query capability
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovan Crone committed Jan 3, 2019
1 parent fa71e00 commit babb80c
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class Machine

public List<MetadataEntry> MetadataEntries { get; set; }

public string SchematicName { get; set; }

public byte[] SchematicBytes { get; set; }

public List<StateBagEntry> StateBagEntries { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.Property(status => status.CommitNumber)
.IsRequired()
.IsConcurrencyToken();


modelBuilder.Entity<Machine>()
.Property(machine => machine.SchematicName)
.IsUnicode(false)
.HasMaxLength(450)
.IsRequired(false);

modelBuilder.Entity<Machine>()
.Property(status => status.UpdatedTime)
.IsRequired();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public async Task<MachineStatus<TState, TInput>> CreateMachineAsync(
var record = new Machine
{
MachineId = id,
SchematicName = schematic.SchematicName,
SchematicBytes = schematicBytes,
StateJson = stateJson,
CommitNumber = commitNumber,
Expand Down

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,24 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace REstate.EntityFrameworkCore.Migrations.SqlServer.Migrations
{
public partial class AddSchematicNameToMachines : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "SchematicName",
table: "Machines",
unicode: false,
maxLength: 450,
nullable: true);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SchematicName",
table: "Machines");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Property<byte[]>("SchematicBytes");

b.Property<string>("SchematicName")
.HasMaxLength(450)
.IsUnicode(false);

b.Property<string>("StateJson")
.IsRequired()
.IsUnicode(false);
Expand Down

0 comments on commit babb80c

Please sign in to comment.