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
e136a056
Commit
e136a056
authored
Jun 05, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
d71cfc4f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
BuilderExtensions.cs
...istency/Microsoft.AspNetCore.Builder/BuilderExtensions.cs
+39
-0
No files found.
src/Cap.Consistency/Microsoft.AspNetCore.Builder/BuilderExtensions.cs
0 → 100644
View file @
e136a056
using
System
;
using
Cap.Consistency
;
using
Microsoft.Extensions.DependencyInjection
;
// ReSharper disable once CheckNamespace
namespace
Microsoft.AspNetCore.Builder
{
/// <summary>
/// Consistence extensions for <see cref="IApplicationBuilder"/>
/// </summary>
public
static
class
BuilderExtensions
{
///<summary>
/// Enables Consistence for the current application
/// </summary>
/// <param name="app">The <see cref="IApplicationBuilder"/> instance this method extends.</param>
/// <returns>The <see cref="IApplicationBuilder"/> instance this method extends.</returns>
public
static
IApplicationBuilder
UseConsistency
(
this
IApplicationBuilder
app
)
{
if
(
app
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
app
));
}
var
marker
=
app
.
ApplicationServices
.
GetService
<
ConsistencyMarkerService
>();
if
(
marker
==
null
)
{
throw
new
InvalidOperationException
(
"Add Consistency must be called on the service collection."
);
}
var
router
=
app
.
ApplicationServices
.
GetService
<
ITopicRouteHandler
>();
var
context
=
new
TopicRouteContext
();
router
.
RouteAsync
(
context
);
return
app
;
}
}
}
\ No newline at end of file
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