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
6541e1aa
Commit
6541e1aa
authored
Aug 26, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add helper methods.
parent
6a1b5441
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
IStorage.cs
src/DotNetCore.CAP/IStorage.cs
+5
-0
IStorageConnection.cs
src/DotNetCore.CAP/IStorageConnection.cs
+10
-0
Helper.cs
src/DotNetCore.CAP/Infrastructure/Helper.cs
+17
-0
No files found.
src/DotNetCore.CAP/IStorage.cs
View file @
6541e1aa
using
System.Threading
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
DotNetCore.CAP.Dashboard
;
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
...
@@ -12,5 +13,9 @@ namespace DotNetCore.CAP
...
@@ -12,5 +13,9 @@ namespace DotNetCore.CAP
/// Initializes the storage. For example, making sure a database is created and migrations are applied.
/// Initializes the storage. For example, making sure a database is created and migrations are applied.
/// </summary>
/// </summary>
Task
InitializeAsync
(
CancellationToken
cancellationToken
);
Task
InitializeAsync
(
CancellationToken
cancellationToken
);
IMonitoringApi
GetMonitoringApi
();
IStorageConnection
GetConnection
();
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/IStorageConnection.cs
View file @
6541e1aa
...
@@ -63,5 +63,15 @@ namespace DotNetCore.CAP
...
@@ -63,5 +63,15 @@ namespace DotNetCore.CAP
/// Creates and returns an <see cref="IStorageTransaction"/>.
/// Creates and returns an <see cref="IStorageTransaction"/>.
/// </summary>
/// </summary>
IStorageTransaction
CreateTransaction
();
IStorageTransaction
CreateTransaction
();
//-------------------------------------------
long
GetSetCount
(
string
key
);
List
<
string
>
GetRangeFromSet
(
string
key
,
int
startingFrom
,
int
endingAt
);
MessageData
GetJobData
(
string
jobId
);
StateData
GetStateData
(
string
jobId
);
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Infrastructure/Helper.cs
View file @
6541e1aa
using
System
;
using
System
;
using
System.ComponentModel
;
using
System.ComponentModel
;
using
System.Globalization
;
using
System.Reflection
;
using
System.Reflection
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
...
@@ -49,6 +50,22 @@ namespace DotNetCore.CAP.Infrastructure
...
@@ -49,6 +50,22 @@ namespace DotNetCore.CAP.Infrastructure
return
Epoch
.
AddSeconds
(
value
);
return
Epoch
.
AddSeconds
(
value
);
}
}
public
static
string
SerializeDateTime
(
DateTime
value
)
{
return
value
.
ToString
(
"o"
,
CultureInfo
.
InvariantCulture
);
}
public
static
DateTime
DeserializeDateTime
(
string
value
)
{
long
timestamp
;
if
(
long
.
TryParse
(
value
,
out
timestamp
))
{
return
FromTimestamp
(
timestamp
);
}
return
DateTime
.
Parse
(
value
,
CultureInfo
.
InvariantCulture
,
DateTimeStyles
.
RoundtripKind
);
}
public
static
bool
IsController
(
TypeInfo
typeInfo
)
public
static
bool
IsController
(
TypeInfo
typeInfo
)
{
{
if
(!
typeInfo
.
IsClass
)
if
(!
typeInfo
.
IsClass
)
...
...
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