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
9de285b5
Commit
9de285b5
authored
Jul 17, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify CapOptions Extension to support multiple extensions.
parent
5583f6af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
CAP.Options.cs
src/DotNetCore.CAP/CAP.Options.cs
+7
-2
CAP.ServiceCollectionExtensions.cs
src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs
+5
-2
No files found.
src/DotNetCore.CAP/CAP.Options.cs
View file @
9de285b5
using
System
;
using
System.Collections.Generic
;
namespace
DotNetCore.CAP
{
...
...
@@ -7,7 +8,7 @@ namespace DotNetCore.CAP
/// </summary>
public
class
CapOptions
{
internal
I
CapOptionsExtension
Extension
{
get
;
private
set
;
}
internal
I
List
<
ICapOptionsExtension
>
Extensions
{
get
;
private
set
;
}
/// <summary>
/// Default value for polling delay timeout, in seconds.
...
...
@@ -23,6 +24,7 @@ namespace DotNetCore.CAP
{
CronExp
=
DefaultCronExp
;
PollingDelay
=
DefaultPollingDelay
;
Extensions
=
new
List
<
ICapOptionsExtension
>();
}
/// <summary>
...
...
@@ -41,7 +43,10 @@ namespace DotNetCore.CAP
/// <param name="extension"></param>
public
void
RegisterExtension
(
ICapOptionsExtension
extension
)
{
Extension
=
extension
??
throw
new
ArgumentNullException
(
nameof
(
extension
));
if
(
extension
==
null
)
throw
new
ArgumentNullException
(
nameof
(
extension
));
Extensions
.
Add
(
extension
);
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs
View file @
9de285b5
...
...
@@ -53,10 +53,13 @@ namespace Microsoft.Extensions.DependencyInjection
services
.
AddSingleton
<
IQueueExecutorFactory
,
QueueExecutorFactory
>();
services
.
AddSingleton
<
IQueueExecutor
,
SubscibeQueueExecutor
>();
//Options
//Options
and extension service
var
options
=
new
CapOptions
();
setupAction
(
options
);
options
.
Extension
?.
AddServices
(
services
);
foreach
(
var
serviceExtension
in
options
.
Extensions
)
{
serviceExtension
.
AddServices
(
services
);
}
services
.
AddSingleton
(
options
);
return
new
CapBuilder
(
services
);
...
...
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