Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
CAP
Commits
97e08531
Commit
97e08531
authored
Jun 22, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update sample.
parent
8595d896
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
141 additions
and
4 deletions
+141
-4
AppDbContext.cs
samples/Sample.Kafka/AppDbContext.cs
+10
-0
ValuesController.cs
samples/Sample.Kafka/Controllers/ValuesController.cs
+1
-1
20170622091105_CreateInit.Designer.cs
...le.Kafka/Migrations/20170622091105_CreateInit.Designer.cs
+45
-0
20170622091105_CreateInit.cs
samples/Sample.Kafka/Migrations/20170622091105_CreateInit.cs
+35
-0
AppDbContextModelSnapshot.cs
samples/Sample.Kafka/Migrations/AppDbContextModelSnapshot.cs
+44
-0
Program.cs
samples/Sample.Kafka/Program.cs
+0
-1
Sample.Kafka.csproj
samples/Sample.Kafka/Sample.Kafka.csproj
+6
-2
No files found.
samples/Sample.Kafka/AppDbContext.cs
View file @
97e08531
...
...
@@ -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
);
}
}
}
samples/Sample.Kafka/Controllers/ValuesController.cs
View file @
97e08531
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
...
...
samples/Sample.Kafka/Migrations/20170622091105_CreateInit.Designer.cs
0 → 100644
View file @
97e08531
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"
);
});
}
}
}
samples/Sample.Kafka/Migrations/20170622091105_CreateInit.cs
0 → 100644
View file @
97e08531
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"
);
}
}
}
samples/Sample.Kafka/Migrations/AppDbContextModelSnapshot.cs
0 → 100644
View file @
97e08531
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"
);
});
}
}
}
samples/Sample.Kafka/Program.cs
View file @
97e08531
...
...
@@ -12,7 +12,6 @@ namespace Sample.Kafka
.
UseContentRoot
(
Directory
.
GetCurrentDirectory
())
.
UseIISIntegration
()
.
UseStartup
<
Startup
>()
.
UseApplicationInsights
()
.
Build
();
host
.
Run
();
...
...
samples/Sample.Kafka/Sample.Kafka.csproj
View file @
97e08531
...
...
@@ -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" />
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment