Commit fb8745ca authored by yangxiaodong's avatar yangxiaodong

Update samples.

parent 1d3692d4
......@@ -11,14 +11,20 @@ namespace Sample.Kafka
public class AppDbContext : DbContext
{
public DbSet<ConsistencyMessage> Messages { get; set; }
public DbSet<CapSentMessage> SentMessages { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
public DbSet<CapReceivedMessage> ReceivedMessages { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("Server=192.168.2.206;Initial Catalog=Test;User Id=cmswuliu;Password=h7xY81agBn*Veiu3;MultipleActiveResultSets=True");
}
protected override void OnModelCreating(ModelBuilder modelBuilder) {
modelBuilder.Entity<ConsistencyMessage>().Property(x => x.RowVersion).IsConcurrencyToken();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<CapSentMessage>().Property(x => x.StateName).HasMaxLength(50);
modelBuilder.Entity<CapReceivedMessage>().Property(x => x.StateName).HasMaxLength(50);
base.OnModelCreating(modelBuilder);
}
}
......
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Sample.Kafka.Migrations
{
public partial class CreateInit : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
Id = table.Column<string>(nullable: false),
Payload = table.Column<string>(nullable: true),
RowVersion = table.Column<byte[]>(nullable: true),
SendTime = table.Column<DateTime>(nullable: false),
Status = table.Column<int>(nullable: false),
Topic = table.Column<string>(nullable: true),
UpdateTime = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Messages", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Messages");
}
}
}
......@@ -4,13 +4,12 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Sample.Kafka;
using DotNetCore.CAP.Infrastructure;
namespace Sample.Kafka.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20170622091105_CreateInit")]
partial class CreateInit
[Migration("20170624095008_CreateDatabase")]
partial class CreateDatabase
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
......@@ -18,27 +17,50 @@ namespace Sample.Kafka.Migrations
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("DotNetCore.CAP.Infrastructure.ConsistencyMessage", b =>
modelBuilder.Entity("DotNetCore.CAP.Infrastructure.CapReceivedMessage", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Payload");
b.Property<DateTime>("Added");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken();
b.Property<string>("Content");
b.Property<DateTime>("SendTime");
b.Property<string>("KeyName");
b.Property<int>("Status");
b.Property<DateTime>("LastRun");
b.Property<string>("Topic");
b.Property<int>("Retries");
b.Property<DateTime?>("UpdateTime");
b.Property<string>("StateName")
.HasMaxLength(50);
b.HasKey("Id");
b.ToTable("Messages");
b.ToTable("ReceivedMessages");
});
modelBuilder.Entity("DotNetCore.CAP.Infrastructure.CapSentMessage", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("Added");
b.Property<string>("Content");
b.Property<string>("KeyName");
b.Property<DateTime>("LastRun");
b.Property<int>("Retries");
b.Property<string>("StateName")
.HasMaxLength(50);
b.HasKey("Id");
b.ToTable("SentMessages");
});
}
}
......
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Sample.Kafka.Migrations
{
public partial class CreateDatabase : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ReceivedMessages",
columns: table => new
{
Id = table.Column<string>(nullable: false),
Added = table.Column<DateTime>(nullable: false),
Content = table.Column<string>(nullable: true),
KeyName = table.Column<string>(nullable: true),
LastRun = table.Column<DateTime>(nullable: false),
Retries = table.Column<int>(nullable: false),
StateName = table.Column<string>(maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ReceivedMessages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SentMessages",
columns: table => new
{
Id = table.Column<string>(nullable: false),
Added = table.Column<DateTime>(nullable: false),
Content = table.Column<string>(nullable: true),
KeyName = table.Column<string>(nullable: true),
LastRun = table.Column<DateTime>(nullable: false),
Retries = table.Column<int>(nullable: false),
StateName = table.Column<string>(maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_SentMessages", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ReceivedMessages");
migrationBuilder.DropTable(
name: "SentMessages");
}
}
}
......@@ -4,7 +4,6 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Sample.Kafka;
using DotNetCore.CAP.Infrastructure;
namespace Sample.Kafka.Migrations
{
......@@ -17,27 +16,50 @@ namespace Sample.Kafka.Migrations
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("DotNetCore.CAP.Infrastructure.ConsistencyMessage", b =>
modelBuilder.Entity("DotNetCore.CAP.Infrastructure.CapReceivedMessage", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Payload");
b.Property<DateTime>("Added");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken();
b.Property<string>("Content");
b.Property<DateTime>("SendTime");
b.Property<string>("KeyName");
b.Property<int>("Status");
b.Property<DateTime>("LastRun");
b.Property<string>("Topic");
b.Property<int>("Retries");
b.Property<DateTime?>("UpdateTime");
b.Property<string>("StateName")
.HasMaxLength(50);
b.HasKey("Id");
b.ToTable("Messages");
b.ToTable("ReceivedMessages");
});
modelBuilder.Entity("DotNetCore.CAP.Infrastructure.CapSentMessage", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("Added");
b.Property<string>("Content");
b.Property<string>("KeyName");
b.Property<DateTime>("LastRun");
b.Property<int>("Retries");
b.Property<string>("StateName")
.HasMaxLength(50);
b.HasKey("Id");
b.ToTable("SentMessages");
});
}
}
......
......@@ -5,8 +5,6 @@
</PropertyGroup>
<ItemGroup>
<Folder Include="Migrations\" />
<Folder Include="Migrations\" />
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment