Procházet zdrojové kódy

update sample.

master
yangxiaodong před 7 roky
rodič
revize
97e0853195
7 změnil soubory, kde provedl 141 přidání a 4 odebrání
  1. +10
    -0
      samples/Sample.Kafka/AppDbContext.cs
  2. +1
    -1
      samples/Sample.Kafka/Controllers/ValuesController.cs
  3. +45
    -0
      samples/Sample.Kafka/Migrations/20170622091105_CreateInit.Designer.cs
  4. +35
    -0
      samples/Sample.Kafka/Migrations/20170622091105_CreateInit.cs
  5. +44
    -0
      samples/Sample.Kafka/Migrations/AppDbContextModelSnapshot.cs
  6. +0
    -1
      samples/Sample.Kafka/Program.cs
  7. +6
    -2
      samples/Sample.Kafka/Sample.Kafka.csproj

+ 10
- 0
samples/Sample.Kafka/AppDbContext.cs Zobrazit soubor

@@ -10,6 +10,16 @@ namespace Sample.Kafka
{
public class AppDbContext : DbContext
{

public DbSet<ConsistencyMessage> Messages { 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();
base.OnModelCreating(modelBuilder);
}
}
}

+ 1
- 1
samples/Sample.Kafka/Controllers/ValuesController.cs Zobrazit soubor

@@ -1,8 +1,8 @@
using System;
using System.Threading.Tasks;
using Cap.Consistency;
using Cap.Consistency.Consumer;
using Cap.Consistency.Kafka;
using Cap.Consistency.Producer;
using Microsoft.AspNetCore.Mvc;

namespace Sample.Kafka.Controllers


+ 45
- 0
samples/Sample.Kafka/Migrations/20170622091105_CreateInit.Designer.cs Zobrazit soubor

@@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Sample.Kafka;
using Cap.Consistency.Infrastructure;

namespace Sample.Kafka.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20170622091105_CreateInit")]
partial class CreateInit
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

modelBuilder.Entity("Cap.Consistency.Infrastructure.ConsistencyMessage", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();

b.Property<string>("Payload");

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

b.Property<DateTime>("SendTime");

b.Property<int>("Status");

b.Property<string>("Topic");

b.Property<DateTime?>("UpdateTime");

b.HasKey("Id");

b.ToTable("Messages");
});
}
}
}

+ 35
- 0
samples/Sample.Kafka/Migrations/20170622091105_CreateInit.cs Zobrazit soubor

@@ -0,0 +1,35 @@
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");
}
}
}

+ 44
- 0
samples/Sample.Kafka/Migrations/AppDbContextModelSnapshot.cs Zobrazit soubor

@@ -0,0 +1,44 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Sample.Kafka;
using Cap.Consistency.Infrastructure;

namespace Sample.Kafka.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

modelBuilder.Entity("Cap.Consistency.Infrastructure.ConsistencyMessage", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();

b.Property<string>("Payload");

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

b.Property<DateTime>("SendTime");

b.Property<int>("Status");

b.Property<string>("Topic");

b.Property<DateTime?>("UpdateTime");

b.HasKey("Id");

b.ToTable("Messages");
});
}
}
}

+ 0
- 1
samples/Sample.Kafka/Program.cs Zobrazit soubor

@@ -12,7 +12,6 @@ namespace Sample.Kafka
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();

host.Run();


+ 6
- 2
samples/Sample.Kafka/Sample.Kafka.csproj Zobrazit soubor

@@ -5,18 +5,22 @@
</PropertyGroup>

<ItemGroup>
<Folder Include="Migrations\" />
<Folder Include="Migrations\" />
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Cap.Consistency.EntityFrameworkCore\Cap.Consistency.EntityFrameworkCore.csproj" />


Načítá se…
Zrušit
Uložit