Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
netcoreplus
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
netcoreplus
Commits
b0697ee7
Commit
b0697ee7
authored
May 14, 2019
by
阿星Plus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ActionOutput
parent
b2d4e426
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
0 deletions
+72
-0
ActionOutput.cs
src/Plus/ActionOutput.cs
+58
-0
ActionOutputOfT.cs
src/Plus/ActionOutputOfT.cs
+14
-0
No files found.
src/Plus/ActionOutput.cs
0 → 100644
View file @
b0697ee7
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Plus
{
/// <summary>
/// Action Output
/// </summary>
public
class
ActionOutput
{
/// <summary>
/// Errors List
/// </summary>
public
IList
<
string
>
Errors
{
get
;
}
/// <summary>
/// 是否成功
/// </summary>
public
bool
Success
=>
Errors
.
Count
==
0
;
/// <summary>
/// Exception
/// </summary>
public
Exception
Exception
{
get
;
set
;
}
public
ActionOutput
()
=>
Errors
=
new
List
<
string
>();
/// <summary>
/// 添加错误消息
/// </summary>
/// <param name="error">错误消息</param>
/// <param name="exception">异常</param>
public
void
AddError
(
string
error
,
Exception
exception
=
null
)
{
Errors
.
Add
(
error
);
Exception
=
exception
;
}
/// <summary>
/// 获取错误消息
/// </summary>
/// <returns></returns>
public
string
GetErrorMessage
()
{
if
(
Errors
.
Count
>
0
)
{
var
stringBuilder
=
new
StringBuilder
();
foreach
(
string
error
in
Errors
)
{
stringBuilder
.
AppendLine
(
error
);
}
return
stringBuilder
.
ToString
();
}
return
string
.
Empty
;
}
}
}
\ No newline at end of file
src/Plus/ActionOutputOfT.cs
0 → 100644
View file @
b0697ee7
namespace
Plus
{
/// <summary>
/// Action Output <see cref="T"/>
/// </summary>
/// <typeparam name="T"></typeparam>
public
class
ActionOutput
<
T
>
:
ActionOutput
{
/// <summary>
/// <see cref="Result"/>
/// </summary>
public
T
Result
{
get
;
set
;
}
}
}
\ 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