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
e39e6615
Commit
e39e6615
authored
May 27, 2019
by
阿星Plus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v1.0.5
parent
9acef28e
Changes
70
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
70 changed files
with
872 additions
and
636 deletions
+872
-636
ActionOutputOfT.cs
src/Plus/ActionOutputOfT.cs
+1
-1
EnumAliasAttribute.cs
src/Plus/CodeAnnotations/EnumAliasAttribute.cs
+7
-0
EnumExtensions.cs
src/Plus/CodeAnnotations/EnumExtensions.cs
+6
-6
TypeList.cs
src/Plus/Collections/TypeList.cs
+57
-0
DefaultSettings.cs
src/Plus/Configuration/DefaultSettings.cs
+7
-0
IEventBusConfiguration.cs
src/Plus/Configuration/Startup/IEventBusConfiguration.cs
+1
-0
ConventionalRegistrationContext.cs
src/Plus/Dependency/ConventionalRegistrationContext.cs
+25
-0
IocResolverExtensions.cs
src/Plus/Dependency/IocResolverExtensions.cs
+15
-0
AuditedEntity.cs
src/Plus/Domain/Entities/Auditing/AuditedEntity.cs
+28
-0
CreationAuditedEntity.cs
src/Plus/Domain/Entities/Auditing/CreationAuditedEntity.cs
+30
-0
EntityAuditingHelper.cs
src/Plus/Domain/Entities/Auditing/EntityAuditingHelper.cs
+2
-3
FullAuditedEntity.cs
src/Plus/Domain/Entities/Auditing/FullAuditedEntity.cs
+33
-0
IAudited.cs
src/Plus/Domain/Entities/Auditing/IAudited.cs
+17
-0
ICreationAudited.cs
src/Plus/Domain/Entities/Auditing/ICreationAudited.cs
+9
-10
IDeletionAudited.cs
src/Plus/Domain/Entities/Auditing/IDeletionAudited.cs
+9
-10
IFullAudited.cs
src/Plus/Domain/Entities/Auditing/IFullAudited.cs
+17
-0
IHasCreationTime.cs
src/Plus/Domain/Entities/Auditing/IHasCreationTime.cs
+5
-6
IHasDeletionTime.cs
src/Plus/Domain/Entities/Auditing/IHasDeletionTime.cs
+4
-5
IHasModificationTime.cs
src/Plus/Domain/Entities/Auditing/IHasModificationTime.cs
+4
-5
IModificationAudited.cs
src/Plus/Domain/Entities/Auditing/IModificationAudited.cs
+9
-10
EntityCache.cs
src/Plus/Domain/Entities/Caching/EntityCache.cs
+6
-0
IAggregateRoot.cs
src/Plus/Domain/Entities/IAggregateRoot.cs
+17
-0
IGeneratesDomainEvents.cs
src/Plus/Domain/Entities/IGeneratesDomainEvents.cs
+1
-4
ISoftDelete.cs
src/Plus/Domain/Entities/ISoftDelete.cs
+1
-5
EntityDeleted.cs
src/Plus/Domain/Events/EntityDeleted.cs
+12
-0
EntityInserted.cs
src/Plus/Domain/Events/EntityInserted.cs
+12
-0
EntityUpdated.cs
src/Plus/Domain/Events/EntityUpdated.cs
+12
-0
IRepositoryOfTEntityAndTPrimaryKey.cs
...Domain/Repositories/IRepositoryOfTEntityAndTPrimaryKey.cs
+1
-0
IActiveUnitOfWork.cs
src/Plus/Domain/Uow/IActiveUnitOfWork.cs
+25
-25
IUnitOfWork.cs
src/Plus/Domain/Uow/IUnitOfWork.cs
+4
-2
InnerUnitOfWorkCompleteHandle.cs
src/Plus/Domain/Uow/InnerUnitOfWorkCompleteHandle.cs
+5
-12
PlusDataFilters.cs
src/Plus/Domain/Uow/PlusDataFilters.cs
+3
-31
UnitOfWorkBase.cs
src/Plus/Domain/Uow/UnitOfWorkBase.cs
+3
-44
DomainEventEntry.cs
src/Plus/Event/Bus/Entities/DomainEventEntry.cs
+2
-8
EntityChangeEntry.cs
src/Plus/Event/Bus/Entities/EntityChangeEntry.cs
+2
-10
EntityChangeEventHelper.cs
src/Plus/Event/Bus/Entities/EntityChangeEventHelper.cs
+1
-5
EntityChangeReport.cs
src/Plus/Event/Bus/Entities/EntityChangeReport.cs
+2
-8
EntityChangedEventData.cs
src/Plus/Event/Bus/Entities/EntityChangedEventData.cs
+2
-1
EntityEventData.cs
src/Plus/Event/Bus/Entities/EntityEventData.cs
+2
-1
EventBus.cs
src/Plus/Event/Bus/EventBus.cs
+81
-126
ExceptionData.cs
src/Plus/Event/Bus/Exceptions/ExceptionData.cs
+1
-5
IEventBus.cs
src/Plus/Event/Bus/IEventBus.cs
+6
-164
NullEventBus.cs
src/Plus/Event/Bus/NullEventBus.cs
+13
-41
DependsOnAttribute.cs
src/Plus/Modules/DependsOnAttribute.cs
+1
-0
PlusModuleCollection.cs
src/Plus/Modules/PlusModuleCollection.cs
+21
-28
PlusModuleManager.cs
src/Plus/Modules/PlusModuleManager.cs
+1
-1
IObjectMapper.cs
src/Plus/ObjectMapping/IObjectMapper.cs
+0
-13
Plus.csproj
src/Plus/Plus.csproj
+8
-2
AssemblyFinder.cs
src/Plus/Reflection/AssemblyFinder.cs
+1
-22
ReflectionHelper.cs
src/Plus/Reflection/ReflectionHelper.cs
+7
-8
CacheExtensions.cs
src/Plus/Runtime/Caching/CacheExtensions.cs
+2
-2
CacheKeyAttribute.cs
src/Plus/Runtime/Caching/CacheKeyAttribute.cs
+43
-0
CachingAttribute.cs
src/Plus/Runtime/Caching/CachingAttribute.cs
+31
-0
CachingBehavior.cs
src/Plus/Runtime/Caching/CachingBehavior.cs
+9
-0
CachingHelper.cs
src/Plus/Runtime/Caching/CachingHelper.cs
+12
-0
TypedCacheExtensions.cs
src/Plus/Runtime/Caching/TypedCacheExtensions.cs
+2
-2
ApplicationServiceBase.cs
src/Plus/Services/ApplicationServiceBase.cs
+2
-10
AuditedEntityDto.cs
src/Plus/Services/Dto/AuditedEntityDto.cs
+18
-0
ComboboxItemDto.cs
src/Plus/Services/Dto/ComboboxItemDto.cs
+24
-0
CreationAuditedEntityDto.cs
src/Plus/Services/Dto/CreationAuditedEntityDto.cs
+23
-0
EntityRequestInput.cs
src/Plus/Services/Dto/EntityRequestInput.cs
+17
-0
EntityResultOutput.cs
src/Plus/Services/Dto/EntityResultOutput.cs
+30
-0
FullAuditedEntityDto.cs
src/Plus/Services/Dto/FullAuditedEntityDto.cs
+21
-0
IDto.cs
src/Plus/Services/Dto/IDto.cs
+6
-0
IInputDto.cs
src/Plus/Services/Dto/IInputDto.cs
+6
-0
IOutputDto.cs
src/Plus/Services/Dto/IOutputDto.cs
+6
-0
IdInput.cs
src/Plus/Services/Dto/IdInput.cs
+28
-0
NullableIdInput.cs
src/Plus/Services/Dto/NullableIdInput.cs
+28
-0
PagedResultOutput.cs
src/Plus/Services/Dto/PagedResultOutput.cs
+18
-0
TypeDto.cs
src/Plus/Services/Dto/TypeDto.cs
+7
-0
No files found.
src/Plus/ActionOutputOfT.cs
View file @
e39e6615
namespace
Plus
{
/// <summary>
///
输出 <see cref="T"/>
///
ActionOutput
/// </summary>
/// <typeparam name="T"></typeparam>
public
class
ActionOutput
<
T
>
:
ActionOutput
...
...
src/Plus/CodeAnnotations/EnumAliasAttribute.cs
View file @
e39e6615
...
...
@@ -7,8 +7,15 @@ namespace Plus.CodeAnnotations
/// </summary>
public
class
EnumAliasAttribute
:
Attribute
{
/// <summary>
/// 别名
/// </summary>
public
string
Alias
{
get
;
set
;
}
/// <summary>
/// 枚举别名属性
/// </summary>
/// <param name="alias"></param>
public
EnumAliasAttribute
(
string
alias
)
{
Alias
=
alias
;
...
...
src/Plus/CodeAnnotations/EnumExtensions.cs
View file @
e39e6615
...
...
@@ -15,20 +15,20 @@ namespace Plus.CodeAnnotations
/// <returns></returns>
public
static
string
ToAlias
(
this
Enum
_enum
)
{
Type
type
=
_enum
.
GetType
();
FieldInfo
field
=
type
.
GetField
(
_enum
.
ToString
());
var
type
=
_enum
.
GetType
();
var
field
=
type
.
GetField
(
_enum
.
ToString
());
if
(
field
==
null
)
{
return
string
.
Empty
;
}
string
result
=
string
.
Empty
;
var
result
=
string
.
Empty
;
object
[]
customAttributes
=
field
.
GetCustomAttributes
(
typeof
(
EnumAliasAttribute
),
inherit
:
false
);
object
[]
array
=
customAttributes
;
var
customAttributes
=
field
.
GetCustomAttributes
(
typeof
(
EnumAliasAttribute
),
inherit
:
false
);
var
array
=
customAttributes
;
for
(
int
i
=
0
;
i
<
array
.
Length
;
i
++)
{
EnumAliasAttribute
enumAliasAttribute
=
(
EnumAliasAttribute
)
array
[
i
];
var
enumAliasAttribute
=
(
EnumAliasAttribute
)
array
[
i
];
result
=
enumAliasAttribute
.
Alias
;
}
return
result
;
...
...
src/Plus/Collections/TypeList.cs
View file @
e39e6615
...
...
@@ -53,67 +53,124 @@ namespace Plus.Collections
_typeList
=
new
List
<
Type
>();
}
/// <summary>
/// Add
/// </summary>
/// <typeparam name="T"></typeparam>
public
void
Add
<
T
>()
where
T
:
TBaseType
{
_typeList
.
Add
(
typeof
(
T
));
}
/// <summary>
/// Add
/// </summary>
/// <param name="item"></param>
public
void
Add
(
Type
item
)
{
CheckType
(
item
);
_typeList
.
Add
(
item
);
}
/// <summary>
/// Insert
/// </summary>
/// <param name="index"></param>
/// <param name="item"></param>
public
void
Insert
(
int
index
,
Type
item
)
{
_typeList
.
Insert
(
index
,
item
);
}
/// <summary>
/// IndexOf
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public
int
IndexOf
(
Type
item
)
{
return
_typeList
.
IndexOf
(
item
);
}
/// <summary>
/// Contains
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public
bool
Contains
<
T
>()
where
T
:
TBaseType
{
return
Contains
(
typeof
(
T
));
}
/// <summary>
/// Contains
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public
bool
Contains
(
Type
item
)
{
return
_typeList
.
Contains
(
item
);
}
/// <summary>
/// Remove
/// </summary>
/// <typeparam name="T"></typeparam>
public
void
Remove
<
T
>()
where
T
:
TBaseType
{
_typeList
.
Remove
(
typeof
(
T
));
}
/// <summary>
/// Remove
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public
bool
Remove
(
Type
item
)
{
return
_typeList
.
Remove
(
item
);
}
/// <summary>
/// RemoveAt
/// </summary>
/// <param name="index"></param>
public
void
RemoveAt
(
int
index
)
{
_typeList
.
RemoveAt
(
index
);
}
/// <summary>
/// Clear
/// </summary>
public
void
Clear
()
{
_typeList
.
Clear
();
}
/// <summary>
/// CopyTo
/// </summary>
/// <param name="array"></param>
/// <param name="arrayIndex"></param>
public
void
CopyTo
(
Type
[]
array
,
int
arrayIndex
)
{
_typeList
.
CopyTo
(
array
,
arrayIndex
);
}
/// <summary>
/// GetEnumerator
/// </summary>
/// <returns></returns>
public
IEnumerator
<
Type
>
GetEnumerator
()
{
return
_typeList
.
GetEnumerator
();
}
/// <summary>
/// GetEnumerator
/// </summary>
/// <returns></returns>
IEnumerator
IEnumerable
.
GetEnumerator
()
{
return
_typeList
.
GetEnumerator
();
...
...
src/Plus/Configuration/DefaultSettings.cs
View file @
e39e6615
namespace
Plus.Configuration
{
/// <summary>
/// DefaultSettings
/// </summary>
public
class
DefaultSettings
:
SettingsBase
{
/// <summary>
/// GetDefaultNameOrConnectionString
/// </summary>
/// <returns></returns>
public
string
GetDefaultNameOrConnectionString
()
{
return
Config
[
"DefaultNameOrConnectionString"
];
...
...
src/Plus/Configuration/Startup/IEventBusConfiguration.cs
View file @
e39e6615
using
Plus.Dependency
;
using
Plus.Event.Bus
;
namespace
Plus.Configuration.Startup
{
...
...
src/Plus/Dependency/ConventionalRegistrationContext.cs
0 → 100644
View file @
e39e6615
using
System.Reflection
;
namespace
Plus.Dependency
{
public
class
ConventionalRegistrationContext
:
IRegistrationContext
{
public
Assembly
Assembly
{
get
;
private
set
;
}
public
IIocManager
IocManager
{
get
;
private
set
;
}
internal
ConventionalRegistrationContext
(
Assembly
assembly
,
IIocManager
iocManager
)
{
Assembly
=
assembly
;
IocManager
=
iocManager
;
}
}
}
\ No newline at end of file
src/Plus/Dependency/IocResolverExtensions.cs
View file @
e39e6615
...
...
@@ -21,5 +21,20 @@ namespace Plus.Dependency
{
return
new
DisposableDependencyObjectWrapper
(
iocResolver
,
iocResolver
.
Resolve
(
type
));
}
public
static
IDisposableDependencyObjectWrapper
<
T
>
ResolveAsDisposable
<
T
>(
this
IIocResolver
iocResolver
,
object
argumentsAsAnonymousType
)
{
return
new
DisposableDependencyObjectWrapper
<
T
>(
iocResolver
,
iocResolver
.
Resolve
<
T
>(
argumentsAsAnonymousType
));
}
public
static
IDisposableDependencyObjectWrapper
<
T
>
ResolveAsDisposable
<
T
>(
this
IIocResolver
iocResolver
,
Type
type
,
object
argumentsAsAnonymousType
)
{
return
new
DisposableDependencyObjectWrapper
<
T
>(
iocResolver
,
(
T
)
iocResolver
.
Resolve
(
type
,
argumentsAsAnonymousType
));
}
public
static
IDisposableDependencyObjectWrapper
ResolveAsDisposable
(
this
IIocResolver
iocResolver
,
Type
type
,
object
argumentsAsAnonymousType
)
{
return
new
DisposableDependencyObjectWrapper
(
iocResolver
,
iocResolver
.
Resolve
(
type
,
argumentsAsAnonymousType
));
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/AuditedEntity.cs
0 → 100644
View file @
e39e6615
using
System
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Plus.Domain.Entities.Auditing
{
[
Serializable
]
public
abstract
class
AuditedEntity
:
AuditedEntity
<
int
>
{
}
[
Serializable
]
public
abstract
class
AuditedEntity
<
TPrimaryKey
>
:
CreationAuditedEntity
<
TPrimaryKey
>,
IAudited
,
ICreationAudited
,
IHasCreationTime
,
IModificationAudited
,
IHasModificationTime
{
public
virtual
DateTime
?
LastModificationTime
{
get
;
set
;
}
public
virtual
long
?
LastModifierUserId
{
get
;
set
;
}
}
[
Serializable
]
public
abstract
class
AuditedEntity
<
TPrimaryKey
,
TUser
>
:
AuditedEntity
<
TPrimaryKey
>,
IAudited
<
TUser
>,
IAudited
,
ICreationAudited
,
IHasCreationTime
,
IModificationAudited
,
IHasModificationTime
,
ICreationAudited
<
TUser
>,
IModificationAudited
<
TUser
>
where
TUser
:
IEntity
<
long
>
{
[
ForeignKey
(
"CreatorUserId"
)]
public
virtual
TUser
CreatorUser
{
get
;
set
;
}
[
ForeignKey
(
"LastModifierUserId"
)]
public
virtual
TUser
LastModifierUser
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/CreationAuditedEntity.cs
0 → 100644
View file @
e39e6615
using
System
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Plus.Domain.Entities.Auditing
{
[
Serializable
]
public
abstract
class
CreationAuditedEntity
:
CreationAuditedEntity
<
int
>
{
}
[
Serializable
]
public
abstract
class
CreationAuditedEntity
<
TPrimaryKey
>
:
Entity
<
TPrimaryKey
>,
ICreationAudited
,
IHasCreationTime
{
public
virtual
DateTime
CreationTime
{
get
;
set
;
}
public
virtual
long
?
CreatorUserId
{
get
;
set
;
}
protected
CreationAuditedEntity
()
{
CreationTime
=
DateTime
.
Now
;
}
}
[
Serializable
]
public
abstract
class
CreationAuditedEntity
<
TPrimaryKey
,
TUser
>
:
CreationAuditedEntity
<
TPrimaryKey
>,
ICreationAudited
<
TUser
>,
ICreationAudited
,
IHasCreationTime
where
TUser
:
IEntity
<
long
>
{
[
ForeignKey
(
"CreatorUserId"
)]
public
virtual
TUser
CreatorUser
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/EntityAuditingHelper.cs
View file @
e39e6615
...
...
@@ -6,12 +6,11 @@ namespace Plus.Domain.Entities.Auditing
{
public
static
void
SetCreationAuditProperties
(
object
entityAsObj
,
long
?
userId
)
{
IHasCreationTime
hasCreationTime
=
entityAsObj
as
IHasCreationTime
;
if
(
hasCreationTime
==
null
)
if
(!(
entityAsObj
is
IHasCreationTime
hasCreationTime
))
{
return
;
}
if
(
hasCreationTime
.
CreationTime
==
default
(
DateTime
)
)
if
(
hasCreationTime
.
CreationTime
==
default
)
{
hasCreationTime
.
CreationTime
=
DateTime
.
Now
;
}
...
...
src/Plus/Domain/Entities/Auditing/FullAuditedEntity.cs
0 → 100644
View file @
e39e6615
using
System
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Plus.Domain.Entities.Auditing
{
[
Serializable
]
public
abstract
class
FullAuditedEntity
:
FullAuditedEntity
<
int
>
{
}
[
Serializable
]
public
abstract
class
FullAuditedEntity
<
TPrimaryKey
>
:
AuditedEntity
<
TPrimaryKey
>,
IFullAudited
,
IAudited
,
ICreationAudited
,
IHasCreationTime
,
IModificationAudited
,
IHasModificationTime
,
IDeletionAudited
,
IHasDeletionTime
,
ISoftDelete
{
public
virtual
bool
IsDeleted
{
get
;
set
;
}
public
virtual
long
?
DeleterUserId
{
get
;
set
;
}
public
virtual
DateTime
?
DeletionTime
{
get
;
set
;
}
}
[
Serializable
]
public
abstract
class
FullAuditedEntity
<
TPrimaryKey
,
TUser
>
:
AuditedEntity
<
TPrimaryKey
,
TUser
>,
IFullAudited
<
TUser
>,
IAudited
<
TUser
>,
IAudited
,
ICreationAudited
,
IHasCreationTime
,
IModificationAudited
,
IHasModificationTime
,
ICreationAudited
<
TUser
>,
IModificationAudited
<
TUser
>,
IFullAudited
,
IDeletionAudited
,
IHasDeletionTime
,
ISoftDelete
,
IDeletionAudited
<
TUser
>
where
TUser
:
IEntity
<
long
>
{
public
virtual
bool
IsDeleted
{
get
;
set
;
}
[
ForeignKey
(
"DeleterUserId"
)]
public
virtual
TUser
DeleterUser
{
get
;
set
;
}
public
virtual
long
?
DeleterUserId
{
get
;
set
;
}
public
virtual
DateTime
?
DeletionTime
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/IAudited.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Domain.Entities.Auditing
{
/// <summary>
/// IAudited
/// </summary>
public
interface
IAudited
:
ICreationAudited
,
IHasCreationTime
,
IModificationAudited
,
IHasModificationTime
{
}
/// <summary>
/// IAudited
/// </summary>
/// <typeparam name="TUser"></typeparam>
public
interface
IAudited
<
TUser
>
:
IAudited
,
ICreationAudited
,
IHasCreationTime
,
IModificationAudited
,
IHasModificationTime
,
ICreationAudited
<
TUser
>,
IModificationAudited
<
TUser
>
where
TUser
:
IEntity
<
long
>
{
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/ICreationAudited.cs
View file @
e39e6615
namespace
Plus.Domain.Entities.Auditing
{
/// <summary>
/// ICreationAudited
/// </summary>
public
interface
ICreationAudited
:
IHasCreationTime
{
long
?
CreatorUserId
{
get
;
set
;
}
long
?
CreatorUserId
{
get
;
set
;
}
}
/// <summary>
/// ICreationAudited
/// </summary>
/// <typeparam name="TUser"></typeparam>
public
interface
ICreationAudited
<
TUser
>
:
ICreationAudited
,
IHasCreationTime
where
TUser
:
IEntity
<
long
>
{
TUser
CreatorUser
{
get
;
set
;
}
TUser
CreatorUser
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/IDeletionAudited.cs
View file @
e39e6615
namespace
Plus.Domain.Entities.Auditing
{
/// <summary>
/// IDeletionAudited
/// </summary>
public
interface
IDeletionAudited
:
IHasDeletionTime
,
ISoftDelete
{
long
?
DeleterUserId
{
get
;
set
;
}
long
?
DeleterUserId
{
get
;
set
;
}
}
/// <summary>
/// IDeletionAudited
/// </summary>
/// <typeparam name="TUser"></typeparam>
public
interface
IDeletionAudited
<
TUser
>
:
IDeletionAudited
,
IHasDeletionTime
,
ISoftDelete
where
TUser
:
IEntity
<
long
>
{
TUser
DeleterUser
{
get
;
set
;
}
TUser
DeleterUser
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/IFullAudited.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Domain.Entities.Auditing
{
/// <summary>
/// IFullAudited
/// </summary>
public
interface
IFullAudited
:
IAudited
,
ICreationAudited
,
IHasCreationTime
,
IModificationAudited
,
IHasModificationTime
,
IDeletionAudited
,
IHasDeletionTime
,
ISoftDelete
{
}
/// <summary>
/// IFullAudited
/// </summary>
/// <typeparam name="TUser"></typeparam>
public
interface
IFullAudited
<
TUser
>
:
IAudited
<
TUser
>,
IAudited
,
ICreationAudited
,
IHasCreationTime
,
IModificationAudited
,
IHasModificationTime
,
ICreationAudited
<
TUser
>,
IModificationAudited
<
TUser
>,
IFullAudited
,
IDeletionAudited
,
IHasDeletionTime
,
ISoftDelete
,
IDeletionAudited
<
TUser
>
where
TUser
:
IEntity
<
long
>
{
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/IHasCreationTime.cs
View file @
e39e6615
...
...
@@ -2,12 +2,11 @@
namespace
Plus.Domain.Entities.Auditing
{
/// <summary>
/// IHasCreationTime
/// </summary>
public
interface
IHasCreationTime
{
DateTime
CreationTime
{
get
;
set
;
}
DateTime
CreationTime
{
get
;
set
;
}
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/IHasDeletionTime.cs
View file @
e39e6615
...
...
@@ -2,12 +2,11 @@
namespace
Plus.Domain.Entities.Auditing
{
/// <summary>
/// IHasDeletionTime
/// </summary>
public
interface
IHasDeletionTime
:
ISoftDelete
{
DateTime
?
DeletionTime
{
get
;
set
;
}
DateTime
?
DeletionTime
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/IHasModificationTime.cs
View file @
e39e6615
...
...
@@ -2,12 +2,11 @@
namespace
Plus.Domain.Entities.Auditing
{
/// <summary>
/// IHasModificationTime
/// </summary>
public
interface
IHasModificationTime
{
DateTime
?
LastModificationTime
{
get
;
set
;
}
DateTime
?
LastModificationTime
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Auditing/IModificationAudited.cs
View file @
e39e6615
namespace
Plus.Domain.Entities.Auditing
{
/// <summary>
/// IModificationAudited
/// </summary>
public
interface
IModificationAudited
:
IHasModificationTime
{
long
?
LastModifierUserId
{
get
;
set
;
}
long
?
LastModifierUserId
{
get
;
set
;
}
}
/// <summary>
/// IModificationAudited
/// </summary>
/// <typeparam name="TUser"></typeparam>
public
interface
IModificationAudited
<
TUser
>
:
IModificationAudited
,
IHasModificationTime
where
TUser
:
IEntity
<
long
>
{
TUser
LastModifierUser
{
get
;
set
;
}
TUser
LastModifierUser
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/Caching/EntityCache.cs
View file @
e39e6615
...
...
@@ -29,6 +29,12 @@ namespace Plus.Domain.Entities.Caching
}
}
/// <summary>
/// EntityCache
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <typeparam name="TCacheItem"></typeparam>
/// <typeparam name="TPrimaryKey"></typeparam>
public
class
EntityCache
<
TEntity
,
TCacheItem
,
TPrimaryKey
>
:
IEventHandler
<
EntityChangedEventData
<
TEntity
>>,
IEntityCache
<
TCacheItem
,
TPrimaryKey
>
where
TEntity
:
class
,
IEntity
<
TPrimaryKey
>
...
...
src/Plus/Domain/Entities/IAggregateRoot.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Domain.Entities
{
/// <summary>
/// IAggregateRoot
/// </summary>
public
interface
IAggregateRoot
:
IAggregateRoot
<
int
>,
IEntity
<
int
>,
IGeneratesDomainEvents
,
IEntity
{
}
/// <summary>
/// IAggregateRoot
/// </summary>
/// <typeparam name="TPrimaryKey"></typeparam>
public
interface
IAggregateRoot
<
TPrimaryKey
>
:
IEntity
<
TPrimaryKey
>,
IGeneratesDomainEvents
{
}
}
\ No newline at end of file
src/Plus/Domain/Entities/IGeneratesDomainEvents.cs
View file @
e39e6615
...
...
@@ -8,9 +8,6 @@ namespace Plus.Domain.Entities
/// </summary>
public
interface
IGeneratesDomainEvents
{
ICollection
<
IEventData
>
DomainEvents
{
get
;
}
ICollection
<
IEventData
>
DomainEvents
{
get
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Entities/ISoftDelete.cs
View file @
e39e6615
...
...
@@ -2,10 +2,6 @@
{
public
interface
ISoftDelete
{
bool
IsDeleted
{
get
;
set
;
}
bool
IsDeleted
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Events/EntityDeleted.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Domain.Events
{
public
class
EntityDeleted
<
T
>
{
public
T
Entity
{
get
;
private
set
;
}
public
EntityDeleted
(
T
entity
)
{
Entity
=
entity
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Events/EntityInserted.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Domain.Events
{
public
class
EntityInserted
<
T
>
{
public
T
Entity
{
get
;
private
set
;
}
public
EntityInserted
(
T
entity
)
{
Entity
=
entity
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Events/EntityUpdated.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Domain.Events
{
public
class
EntityUpdated
<
T
>
{
public
T
Entity
{
get
;
private
set
;
}
public
EntityUpdated
(
T
entity
)
{
Entity
=
entity
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Repositories/IRepositoryOfTEntityAndTPrimaryKey.cs
View file @
e39e6615
using
Plus.Domain.Entities
;
using
Plus.Domain.Uow
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
src/Plus/Domain/Uow/IActiveUnitOfWork.cs
View file @
e39e6615
...
...
@@ -96,30 +96,30 @@ namespace Plus.Domain.Uow
/// <param name="value">Value of the parameter to be set</param>
IDisposable
SetFilterParameter
(
string
filterName
,
string
parameterName
,
object
value
);
/// <summary>
/// Sets/Changes Tenant's Id for this UOW.
/// </summary>
/// <param name="tenantId">The tenant id.</param>
/// <returns>A disposable object to restore old TenantId value when you dispose it</returns>
IDisposable
SetTenantId
(
int
?
tenantId
);
/// <summary>
/// Sets/Changes Tenant's Id for this UOW.
/// </summary>
/// <param name="tenantId">The tenant id</param>
/// <param name="switchMustHaveTenantEnableDisable">
/// True to enable/disable <see cref="IMustHaveTenant"/> based on given tenantId.
/// Enables <see cref="IMustHaveTenant"/> filter if tenantId is not null.
/// Disables <see cref="IMustHaveTenant"/> filter if tenantId is null.
/// This value is true for <see cref="SetTenantId(int?)"/> method.
/// </param>
/// <returns>A disposable object to restore old TenantId value when you dispose it</returns>
IDisposable
SetTenantId
(
int
?
tenantId
,
bool
switchMustHaveTenantEnableDisable
);
/// <summary>
/// Gets Tenant Id for this UOW.
/// </summary>
/// <returns></returns>
int
?
GetTenantId
();
///
//
<summary>
///
//
Sets/Changes Tenant's Id for this UOW.
///
//
</summary>
///
//
<param name="tenantId">The tenant id.</param>
///
//
<returns>A disposable object to restore old TenantId value when you dispose it</returns>
//
IDisposable SetTenantId(int? tenantId);
///
//
<summary>
///
//
Sets/Changes Tenant's Id for this UOW.
///
//
</summary>
///
//
<param name="tenantId">The tenant id</param>
///
//
<param name="switchMustHaveTenantEnableDisable">
///
//
True to enable/disable <see cref="IMustHaveTenant"/> based on given tenantId.
///
//
Enables <see cref="IMustHaveTenant"/> filter if tenantId is not null.
///
//
Disables <see cref="IMustHaveTenant"/> filter if tenantId is null.
///
//
This value is true for <see cref="SetTenantId(int?)"/> method.
///
//
</param>
///
//
<returns>A disposable object to restore old TenantId value when you dispose it</returns>
//
IDisposable SetTenantId(int? tenantId, bool switchMustHaveTenantEnableDisable);
///
//
<summary>
///
//
Gets Tenant Id for this UOW.
///
//
</summary>
///
//
<returns></returns>
//
int? GetTenantId();
}
}
\ No newline at end of file
src/Plus/Domain/Uow/IUnitOfWork.cs
View file @
e39e6615
namespace
Plus.Domain.Uow
using
System
;
namespace
Plus.Domain.Uow
{
/// <summary>
/// 工作单元接口
/// </summary>
public
interface
IUnitOfWork
:
IActiveUnitOfWork
,
IUnitOfWorkCompleteHandle
public
interface
IUnitOfWork
:
IActiveUnitOfWork
,
IUnitOfWorkCompleteHandle
,
IDisposable
{
string
Id
{
get
;
}
...
...
src/Plus/Domain/Uow/InnerUnitOfWorkCompleteHandle.cs
View file @
e39e6615
...
...
@@ -15,6 +15,7 @@ namespace Plus.Domain.Uow
public
const
string
DidNotCallCompleteMethodExceptionMessage
=
"未调用完整方法的工作单元"
;
private
volatile
bool
_isCompleteCalled
;
private
volatile
bool
_isDisposed
;
public
void
Complete
()
...
...
@@ -30,21 +31,13 @@ namespace Plus.Domain.Uow
public
void
Dispose
()
{
if
(
_isDisposed
)
{
return
;
}
_isDisposed
=
true
;
if
(!
_isCompleteCalled
)
if
(!
_isDisposed
)
{
if
(
HasException
())
_isDisposed
=
true
;
if
(!
_isCompleteCalled
&&
!
HasException
())
{
return
;
throw
new
PlusException
(
"Did not call Complete method of a unit of work."
)
;
}
throw
new
PlusException
(
DidNotCallCompleteMethodExceptionMessage
);
}
}
...
...
src/Plus/Domain/Uow/PlusDataFilters.cs
View file @
e39e6615
namespace
Plus.Domain.Uow
using
Plus.Domain.Entities
;
namespace
Plus.Domain.Uow
{
/// <summary>
/// Standard filters of Plus.
...
...
@@ -12,35 +14,5 @@
/// See <see cref="ISoftDelete"/> interface.
/// </summary>
public
const
string
SoftDelete
=
"SoftDelete"
;
/// <summary>
/// "MustHaveTenant".
/// Tenant filter to prevent getting data that is
/// not belong to current tenant.
/// </summary>
public
const
string
MustHaveTenant
=
"MustHaveTenant"
;
/// <summary>
/// "MayHaveTenant".
/// Tenant filter to prevent getting data that is
/// not belong to current tenant.
/// </summary>
public
const
string
MayHaveTenant
=
"MayHaveTenant"
;
/// <summary>
/// Standard parameters of Plus.
/// </summary>
public
static
class
Parameters
{
/// <summary>
/// "tenantId".
/// </summary>
public
const
string
TenantId
=
"tenantId"
;
/// <summary>
/// "isDeleted".
/// </summary>
public
const
string
IsDeleted
=
"isDeleted"
;
}
}
}
\ No newline at end of file
src/Plus/Domain/Uow/UnitOfWorkBase.cs
View file @
e39e6615
...
...
@@ -22,8 +22,6 @@ namespace Plus.Domain.Uow
private
Exception
_exception
;
private
int
?
_tenantId
;
public
string
Id
{
get
;
}
[
DoNotWire
]
...
...
@@ -41,7 +39,7 @@ namespace Plus.Domain.Uow
public
bool
IsDisposed
{
get
;
private
set
;
}
protected
IUnitOfWorkFilterExecuter
FilterExecuter
{
get
;
}
protected
IUnitOfWorkFilterExecuter
FilterExecuter
{
get
;
}
public
event
EventHandler
Completed
;
...
...
@@ -148,7 +146,7 @@ namespace Plus.Domain.Uow
catch
(
Exception
exception
)
{
Exception
ex
=
_exception
=
exception
;
throw
;
throw
ex
;
}
}
...
...
@@ -164,7 +162,7 @@ namespace Plus.Domain.Uow
catch
(
Exception
exception
)
{
Exception
ex
=
_exception
=
exception
;
throw
;
throw
ex
;
}
}
...
...
@@ -282,44 +280,5 @@ namespace Plus.Domain.Uow
{
return
"[UnitOfWork "
+
Id
+
"]"
;
}
public
virtual
IDisposable
SetTenantId
(
int
?
tenantId
)
{
return
SetTenantId
(
tenantId
,
true
);
}
public
virtual
IDisposable
SetTenantId
(
int
?
tenantId
,
bool
switchMustHaveTenantEnableDisable
)
{
var
oldTenantId
=
_tenantId
;
_tenantId
=
tenantId
;
IDisposable
mustHaveTenantEnableChange
;
if
(
switchMustHaveTenantEnableDisable
)
{
mustHaveTenantEnableChange
=
tenantId
==
null
?
DisableFilter
(
PlusDataFilters
.
MustHaveTenant
)
:
EnableFilter
(
PlusDataFilters
.
MustHaveTenant
);
}
else
{
mustHaveTenantEnableChange
=
NullDisposable
.
Instance
;
}
var
mayHaveTenantChange
=
SetFilterParameter
(
PlusDataFilters
.
MayHaveTenant
,
PlusDataFilters
.
Parameters
.
TenantId
,
tenantId
);
var
mustHaveTenantChange
=
SetFilterParameter
(
PlusDataFilters
.
MustHaveTenant
,
PlusDataFilters
.
Parameters
.
TenantId
,
tenantId
??
0
);
return
new
DisposeAction
(()
=>
{
mayHaveTenantChange
.
Dispose
();
mustHaveTenantChange
.
Dispose
();
mustHaveTenantEnableChange
.
Dispose
();
_tenantId
=
oldTenantId
;
});
}
public
int
?
GetTenantId
()
{
return
_tenantId
;
}
}
}
\ No newline at end of file
src/Plus/Event/Bus/Entities/DomainEventEntry.cs
View file @
e39e6615
...
...
@@ -5,15 +5,9 @@ namespace Plus.Event.Bus.Entities
[
Serializable
]
public
class
DomainEventEntry
{
public
object
SourceEntity
{
get
;
}
public
object
SourceEntity
{
get
;
}
public
IEventData
EventData
{
get
;
}
public
IEventData
EventData
{
get
;
}
public
DomainEventEntry
(
object
sourceEntity
,
IEventData
eventData
)
{
...
...
src/Plus/Event/Bus/Entities/EntityChangeEntry.cs
View file @
e39e6615
...
...
@@ -5,17 +5,9 @@ namespace Plus.Event.Bus.Entities
[
Serializable
]
public
class
EntityChangeEntry
{
public
object
Entity
{
get
;
set
;
}
public
object
Entity
{
get
;
set
;
}
public
EntityChangeType
ChangeType
{
get
;
set
;
}
public
EntityChangeType
ChangeType
{
get
;
set
;
}
public
EntityChangeEntry
(
object
entity
,
EntityChangeType
changeType
)
{
...
...
src/Plus/Event/Bus/Entities/EntityChangeEventHelper.cs
View file @
e39e6615
...
...
@@ -10,11 +10,7 @@ namespace Plus.Event.Bus.Entities
{
private
readonly
IUnitOfWorkManager
_unitOfWorkManager
;
public
IEventBus
EventBus
{
get
;
set
;
}
public
IEventBus
EventBus
{
get
;
set
;
}
public
EntityChangeEventHelper
(
IUnitOfWorkManager
unitOfWorkManager
)
{
...
...
src/Plus/Event/Bus/Entities/EntityChangeReport.cs
View file @
e39e6615
...
...
@@ -4,15 +4,9 @@ namespace Plus.Event.Bus.Entities
{
public
class
EntityChangeReport
{
public
List
<
EntityChangeEntry
>
ChangedEntities
{
get
;
}
public
List
<
EntityChangeEntry
>
ChangedEntities
{
get
;
}
public
List
<
DomainEventEntry
>
DomainEvents
{
get
;
}
public
List
<
DomainEventEntry
>
DomainEvents
{
get
;
}
public
EntityChangeReport
()
{
...
...
src/Plus/Event/Bus/Entities/EntityChangedEventData.cs
View file @
e39e6615
using
System
;
using
Plus.Domain.Entities
;
using
System
;
namespace
Plus.Event.Bus.Entities
{
...
...
src/Plus/Event/Bus/Entities/EntityEventData.cs
View file @
e39e6615
using
System
;
using
Plus.Domain.Entities
;
using
System
;
namespace
Plus.Event.Bus.Entities
{
...
...
src/Plus/Event/Bus/EventBus.cs
View file @
e39e6615
This diff is collapsed.
Click to expand it.
src/Plus/Event/Bus/Exceptions/ExceptionData.cs
View file @
e39e6615
...
...
@@ -4,11 +4,7 @@ namespace Plus.Event.Bus.Exceptions
{
public
class
ExceptionData
:
EventData
{
public
Exception
Exception
{
get
;
private
set
;
}
public
Exception
Exception
{
get
;
private
set
;
}
public
ExceptionData
(
Exception
exception
)
{
...
...
src/Plus/Event/Bus/IEventBus.cs
View file @
e39e6615
...
...
@@ -10,204 +10,46 @@ namespace Plus.Event.Bus
/// </summary>
public
interface
IEventBus
{
#
region
Register
/// <summary>
/// Registers to an event.
/// Given action is called for all event occurrences.
/// </summary>
/// <param name="action">Action to handle events</param>
/// <typeparam name="TEventData">Event type</typeparam>
IDisposable
Register
<
TEventData
>(
Action
<
TEventData
>
action
)
where
TEventData
:
IEventData
;
/// <summary>
/// Registers to an event.
/// Given action is called for all event occurrences.
/// </summary>
/// <param name="action">Action to handle events</param>
/// <typeparam name="TEventData">Event type</typeparam>
IDisposable
AsyncRegister
<
TEventData
>(
Func
<
TEventData
,
Task
>
action
)
where
TEventData
:
IEventData
;
/// <summary>
/// Registers to an event.
/// Same (given) instance of the handler is used for all event occurrences.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="handler">Object to handle the event</param>
IDisposable
Register
<
TEventData
>(
IEventHandler
<
TEventData
>
handler
)
where
TEventData
:
IEventData
;
/// <summary>
/// Registers to an event.
/// Same (given) instance of the async handler is used for all event occurrences.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="handler">Object to handle the event</param>
IDisposable
AsyncRegister
<
TEventData
>(
IAsyncEventHandler
<
TEventData
>
handler
)
where
TEventData
:
IEventData
;
/// <summary>
/// Registers to an event.
/// A new instance of <see cref="THandler"/> object is created for every event occurrence.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <typeparam name="THandler">Type of the event handler</typeparam>
IDisposable
Register
<
TEventData
,
THandler
>()
where
TEventData
:
IEventData
where
THandler
:
IEventHandler
,
new
();
/// <summary>
/// Registers to an event.
/// Same (given) instance of the handler is used for all event occurrences.
/// </summary>
/// <param name="eventType">Event type</param>
/// <param name="handler">Object to handle the event</param>
IDisposable
Register
<
TEventData
,
THandler
>()
where
TEventData
:
IEventData
where
THandler
:
IEventHandler
<
TEventData
>,
new
();
IDisposable
Register
(
Type
eventType
,
IEventHandler
handler
);
/// <summary>
/// Registers to an event.
/// Given factory is used to create/release handlers
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="factory">A factory to create/release handlers</param>
IDisposable
Register
<
TEventData
>(
IEventHandlerFactory
factory
)
where
TEventData
:
IEventData
;
/// <summary>
/// Registers to an event.
/// </summary>
/// <param name="eventType">Event type</param>
/// <param name="factory">A factory to create/release handlers</param>
IDisposable
Register
(
Type
eventType
,
IEventHandlerFactory
factory
);
#
endregion
#
region
Unregister
/// <summary>
/// Unregisters from an event.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="action"></param>
IDisposable
Register
<
TEventData
>(
IEventHandlerFactory
handlerFactory
)
where
TEventData
:
IEventData
;
IDisposable
Register
(
Type
eventType
,
IEventHandlerFactory
handlerFactory
);
void
Unregister
<
TEventData
>(
Action
<
TEventData
>
action
)
where
TEventData
:
IEventData
;
/// <summary>
/// Unregisters from an event.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="action"></param>
void
AsyncUnregister
<
TEventData
>(
Func
<
TEventData
,
Task
>
action
)
where
TEventData
:
IEventData
;
/// <summary>
/// Unregisters from an event.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="handler">Handler object that is registered before</param>
void
Unregister
<
TEventData
>(
IEventHandler
<
TEventData
>
handler
)
where
TEventData
:
IEventData
;
/// <summary>
/// Unregisters from an event.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="handler">Handler object that is registered before</param>
void
AsyncUnregister
<
TEventData
>(
IAsyncEventHandler
<
TEventData
>
handler
)
where
TEventData
:
IEventData
;
/// <summary>
/// Unregisters from an event.
/// </summary>
/// <param name="eventType">Event type</param>
/// <param name="handler">Handler object that is registered before</param>
void
Unregister
(
Type
eventType
,
IEventHandler
handler
);
/// <summary>
/// Unregisters from an event.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="factory">Factory object that is registered before</param>
void
Unregister
<
TEventData
>(
IEventHandlerFactory
factory
)
where
TEventData
:
IEventData
;
/// <summary>
/// Unregisters from an event.
/// </summary>
/// <param name="eventType">Event type</param>
/// <param name="factory">Factory object that is registered before</param>
void
Unregister
(
Type
eventType
,
IEventHandlerFactory
factory
);
/// <summary>
/// Unregisters all event handlers of given event type.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
void
UnregisterAll
<
TEventData
>()
where
TEventData
:
IEventData
;
/// <summary>
/// Unregisters all event handlers of given event type.
/// </summary>
/// <param name="eventType">Event type</param>
void
UnregisterAll
(
Type
eventType
);
#
endregion
#
region
Trigger
/// <summary>
/// Triggers an event.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="eventData">Related data for the event</param>
void
Trigger
<
TEventData
>(
TEventData
eventData
)
where
TEventData
:
IEventData
;
/// <summary>
/// Triggers an event.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="eventSource">The object which triggers the event</param>
/// <param name="eventData">Related data for the event</param>
void
Trigger
<
TEventData
>(
object
eventSource
,
TEventData
eventData
)
where
TEventData
:
IEventData
;
/// <summary>
/// Triggers an event.
/// </summary>
/// <param name="eventType">Event type</param>
/// <param name="eventData">Related data for the event</param>
void
Trigger
(
Type
eventType
,
IEventData
eventData
);
/// <summary>
/// Triggers an event.
/// </summary>
/// <param name="eventType">Event type</param>
/// <param name="eventSource">The object which triggers the event</param>
/// <param name="eventData">Related data for the event</param>
void
Trigger
(
Type
eventType
,
object
eventSource
,
IEventData
eventData
);
/// <summary>
/// Triggers an event asynchronously.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="eventData">Related data for the event</param>
/// <returns>The task to handle async operation</returns>
Task
TriggerAsync
<
TEventData
>(
TEventData
eventData
)
where
TEventData
:
IEventData
;
/// <summary>
/// Triggers an event asynchronously.
/// </summary>
/// <typeparam name="TEventData">Event type</typeparam>
/// <param name="eventSource">The object which triggers the event</param>
/// <param name="eventData">Related data for the event</param>
/// <returns>The task to handle async operation</returns>
Task
TriggerAsync
<
TEventData
>(
object
eventSource
,
TEventData
eventData
)
where
TEventData
:
IEventData
;
/// <summary>
/// Triggers an event asynchronously.
/// </summary>
/// <param name="eventType">Event type</param>
/// <param name="eventData">Related data for the event</param>
/// <returns>The task to handle async operation</returns>
Task
TriggerAsync
(
Type
eventType
,
IEventData
eventData
);
/// <summary>
/// Triggers an event asynchronously.
/// </summary>
/// <param name="eventType">Event type</param>
/// <param name="eventSource">The object which triggers the event</param>
/// <param name="eventData">Related data for the event</param>
/// <returns>The task to handle async operation</returns>
Task
TriggerAsync
(
Type
eventType
,
object
eventSource
,
IEventData
eventData
);
#
endregion
}
}
\ No newline at end of file
src/Plus/Event/Bus/NullEventBus.cs
View file @
e39e6615
...
...
@@ -10,14 +10,10 @@ namespace Plus.Event.Bus
/// </summary>
public
sealed
class
NullEventBus
:
IEventBus
{
/// <summary>
/// 获取 <see cref="NullEventBus"/> 实例
/// </summary>
public
static
NullEventBus
Instance
{
get
;
}
=
new
NullEventBus
();
private
NullEventBus
()
{
}
public
IDisposable
Register
<
TEventData
>(
Action
<
TEventData
>
action
)
where
TEventData
:
IEventData
...
...
@@ -25,24 +21,12 @@ namespace Plus.Event.Bus
return
NullDisposable
.
Instance
;
}
public
IDisposable
AsyncRegister
<
TEventData
>(
Func
<
TEventData
,
Task
>
action
)
where
TEventData
:
IEventData
{
return
NullDisposable
.
Instance
;
}
public
IDisposable
Register
<
TEventData
>(
IEventHandler
<
TEventData
>
handler
)
where
TEventData
:
IEventData
{
return
NullDisposable
.
Instance
;
}
public
IDisposable
AsyncRegister
<
TEventData
>(
IAsyncEventHandler
<
TEventData
>
handler
)
where
TEventData
:
IEventData
{
return
NullDisposable
.
Instance
;
}
public
IDisposable
Register
<
TEventData
,
THandler
>()
where
TEventData
:
IEventData
where
THandler
:
IEventHandler
,
new
()
public
IDisposable
Register
<
TEventData
,
THandler
>()
where
TEventData
:
IEventData
where
THandler
:
IEventHandler
<
TEventData
>,
new
()
{
return
NullDisposable
.
Instance
;
}
...
...
@@ -64,22 +48,10 @@ namespace Plus.Event.Bus
public
void
Unregister
<
TEventData
>(
Action
<
TEventData
>
action
)
where
TEventData
:
IEventData
{
}
public
void
AsyncUnregister
<
TEventData
>(
Func
<
TEventData
,
Task
>
action
)
where
TEventData
:
IEventData
{
}
public
void
Unregister
<
TEventData
>(
IEventHandler
<
TEventData
>
handler
)
where
TEventData
:
IEventData
{
}
public
void
AsyncUnregister
<
TEventData
>(
IAsyncEventHandler
<
TEventData
>
handler
)
where
TEventData
:
IEventData
{
}
public
void
Unregister
(
Type
eventType
,
IEventHandler
handler
)
...
...
@@ -88,62 +60,62 @@ namespace Plus.Event.Bus
public
void
Unregister
<
TEventData
>(
IEventHandlerFactory
factory
)
where
TEventData
:
IEventData
{
}
public
void
Unregister
(
Type
eventType
,
IEventHandlerFactory
factory
)
{
}
public
void
UnregisterAll
<
TEventData
>()
where
TEventData
:
IEventData
{
}
public
void
UnregisterAll
(
Type
eventType
)
{
}
public
void
Trigger
<
TEventData
>(
TEventData
eventData
)
where
TEventData
:
IEventData
{
}
public
void
Trigger
<
TEventData
>(
object
eventSource
,
TEventData
eventData
)
where
TEventData
:
IEventData
{
}
public
void
Trigger
(
Type
eventType
,
IEventData
eventData
)
{
}
public
void
Trigger
(
Type
eventType
,
object
eventSource
,
IEventData
eventData
)
{
}
public
Task
TriggerAsync
<
TEventData
>(
TEventData
eventData
)
where
TEventData
:
IEventData
{
return
Task
.
CompletedTask
;
return
new
Task
(
delegate
{
});
}
public
Task
TriggerAsync
<
TEventData
>(
object
eventSource
,
TEventData
eventData
)
where
TEventData
:
IEventData
{
return
Task
.
CompletedTask
;
return
new
Task
(
delegate
{
});
}
public
Task
TriggerAsync
(
Type
eventType
,
IEventData
eventData
)
{
return
Task
.
CompletedTask
;
return
new
Task
(
delegate
{
});
}
public
Task
TriggerAsync
(
Type
eventType
,
object
eventSource
,
IEventData
eventData
)
{
return
Task
.
CompletedTask
;
return
new
Task
(
delegate
{
});
}
}
}
\ No newline at end of file
src/Plus/Modules/DependsOnAttribute.cs
View file @
e39e6615
...
...
@@ -5,6 +5,7 @@ namespace Plus.Modules
/// <summary>
/// 用于定义模块间的依赖关系
/// </summary>
[
AttributeUsage
(
AttributeTargets
.
Class
,
AllowMultiple
=
true
)]
public
class
DependsOnAttribute
:
Attribute
{
public
Type
[]
DependedModuleTypes
{
get
;
private
set
;
}
...
...
src/Plus/Modules/PlusModuleCollection.cs
View file @
e39e6615
...
...
@@ -28,46 +28,39 @@ namespace Plus.Modules
public
List
<
PlusModuleInfo
>
GetSortedModuleListByDependency
()
{
var
sortedModules
=
this
.
SortByDependencies
(
x
=>
x
.
Dependencies
);
EnsureKernelModuleToBeFirst
(
sortedModules
);
EnsureStartupModuleToBeLast
(
sortedModules
,
StartupModuleType
);
return
sortedModules
;
return
this
.
SortByDependencies
((
PlusModuleInfo
x
)
=>
x
.
Dependencies
);
}
public
static
void
EnsureKernelModuleToBeFirst
(
List
<
PlusModuleInfo
>
modules
)
public
void
EnsureLeadershipToBeFirst
(
)
{
var
kernelModuleIndex
=
modules
.
FindIndex
(
m
=>
m
.
Type
==
typeof
(
PlusLeadershipModule
));
if
(
kernelModuleIndex
<=
0
)
{
return
;
}
var
kernelModule
=
modules
[
kernelModuleIndex
];
modules
.
RemoveAt
(
kernelModuleIndex
);
modules
.
Insert
(
0
,
kernelModule
);
EnsureLeadershipToBeFirst
(
this
);
}
public
static
void
EnsureStartupModuleToBeLast
(
List
<
PlusModuleInfo
>
modules
,
Type
startupModuleType
)
public
void
EnsureStartupModuleToBeLast
(
)
{
var
startupModuleIndex
=
modules
.
FindIndex
(
m
=>
m
.
Type
==
startupModuleType
);
if
(
startupModuleIndex
>=
modules
.
Count
-
1
)
{
return
;
}
var
startupModule
=
modules
[
startupModuleIndex
];
modules
.
RemoveAt
(
startupModuleIndex
);
modules
.
Add
(
startupModule
);
EnsureStartupModuleToBeLast
(
this
,
StartupModuleType
);
}
public
void
EnsureKernelModuleToBeFirst
(
)
public
static
void
EnsureLeadershipToBeFirst
(
List
<
PlusModuleInfo
>
modules
)
{
EnsureKernelModuleToBeFirst
(
this
);
int
num
=
modules
.
FindIndex
((
PlusModuleInfo
x
)
=>
x
.
Type
==
typeof
(
PlusLeadershipModule
));
if
(
num
>
0
)
{
PlusModuleInfo
item
=
modules
[
num
];
modules
.
RemoveAt
(
num
);
modules
.
Insert
(
0
,
item
);
}
}
public
void
EnsureStartupModuleToBeLast
(
)
public
static
void
EnsureStartupModuleToBeLast
(
List
<
PlusModuleInfo
>
modules
,
Type
startupModuleType
)
{
EnsureStartupModuleToBeLast
(
this
,
StartupModuleType
);
int
num
=
modules
.
FindIndex
((
PlusModuleInfo
x
)
=>
x
.
Type
==
startupModuleType
);
if
(
num
<
modules
.
Count
-
1
)
{
PlusModuleInfo
item
=
modules
[
num
];
modules
.
RemoveAt
(
num
);
modules
.
Add
(
item
);
}
}
}
}
\ No newline at end of file
src/Plus/Modules/PlusModuleManager.cs
View file @
e39e6615
...
...
@@ -69,7 +69,7 @@ namespace Plus.Modules
RegisterModules
(
moduleTypes
);
CreateModules
(
moduleTypes
);
_modules
.
Ensure
KernelModule
ToBeFirst
();
_modules
.
Ensure
Leadership
ToBeFirst
();
_modules
.
EnsureStartupModuleToBeLast
();
SetDependencies
();
...
...
src/Plus/ObjectMapping/IObjectMapper.cs
View file @
e39e6615
...
...
@@ -5,21 +5,8 @@
/// </summary>
public
interface
IObjectMapper
{
/// <summary>
/// Converts an object to another. Creates a new object of <see cref="TDestination"/>.
/// </summary>
/// <typeparam name="TDestination">Type of the destination object</typeparam>
/// <param name="source">Source object</param>
TDestination
Map
<
TDestination
>(
object
source
);
/// <summary>
/// Execute a mapping from the source object to the existing destination object
/// </summary>
/// <typeparam name="TSource">Source type</typeparam>
/// <typeparam name="TDestination">Destination type</typeparam>
/// <param name="source">Source object</param>
/// <param name="destination">Destination object</param>
/// <returns>Returns the same <see cref="destination"/> object after mapping operation</returns>
TDestination
Map
<
TSource
,
TDestination
>(
TSource
source
,
TDestination
destination
);
}
}
\ No newline at end of file
src/Plus/Plus.csproj
View file @
e39e6615
...
...
@@ -14,14 +14,20 @@
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/Meowv/.netcoreplus</PackageProjectUrl>
<PackageIconUrl>https://avatars2.githubusercontent.com/u/13010050</PackageIconUrl>
<PackageLicense
Url>https://raw.githubusercontent.com/Meowv/.netcoreplus/master/LICENSE</PackageLicenseUrl
>
<PackageLicense
Expression>MIT</PackageLicenseExpression
>
<PackageTags>plus;.netcoreplus;</PackageTags>
<PackageReleaseNotes>Plus</PackageReleaseNotes>
<Version>1.0.
3.3
</Version>
<Version>1.0.
5
</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>Plus.xml</DocumentationFile>
<NoWarn>1701;1702;1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>Plus\Plus.xml</DocumentationFile>
<NoWarn>1701;1702;1591</NoWarn>
</PropertyGroup>
<ItemGroup>
...
...
src/Plus/Reflection/AssemblyFinder.cs
View file @
e39e6615
...
...
@@ -10,36 +10,15 @@ namespace Plus.Reflection
/// </summary>
public
class
AssemblyFinder
:
IAssemblyFinder
{
//private readonly IPlusModuleManager _moduleManager;
public
static
AssemblyFinder
Instance
{
get
;
private
set
;
}
public
static
AssemblyFinder
Instance
{
get
;
private
set
;
}
static
AssemblyFinder
()
{
Instance
=
new
AssemblyFinder
();
}
//public AssemblyFinder(IPlusModuleManager moduleManager)
//{
// _moduleManager = moduleManager;
//}
public
List
<
Assembly
>
GetAllAssemblies
()
{
//var assemblies = new List<Assembly>();
//foreach (var module in _moduleManager.Modules)
//{
// assemblies.Add(module.Assembly);
// assemblies.AddRange(module.Instance.GetAdditionalAssemblies());
//}
//return assemblies.Distinct().ToList();
return
AppDomain
.
CurrentDomain
.
GetAssemblies
().
ToList
();
}
}
...
...
src/Plus/Reflection/ReflectionHelper.cs
View file @
e39e6615
...
...
@@ -123,14 +123,13 @@ namespace Plus.Reflection
}
/// <summary>
/// Tries to gets an of attribute defined for a class member and it's declaring type including inherited attributes.
/// Returns default value if it's not declared at all.
///
/// </summary>
/// <typeparam name="TAttribute">
Type of the attribute
</typeparam>
/// <param name="memberInfo">
MemberInfo
</param>
/// <param name="defaultValue">
Default value (null as default)
</param>
/// <
param name="inherit">Inherit attribute from base classes</param
>
public
static
TAttribute
GetSingleAttributeOfMemberOrDeclaringTypeOrDefault
<
TAttribute
>(
MemberInfo
memberInfo
,
TAttribute
defaultValue
=
default
,
bool
inherit
=
true
)
/// <typeparam name="TAttribute"></typeparam>
/// <param name="memberInfo"></param>
/// <param name="defaultValue"></param>
/// <
returns></returns
>
public
static
TAttribute
GetSingleAttributeOfMemberOrDeclaringTypeOrDefault
<
TAttribute
>(
MemberInfo
memberInfo
,
TAttribute
defaultValue
=
default
)
where
TAttribute
:
class
{
return
memberInfo
.
GetCustomAttributes
(
true
).
OfType
<
TAttribute
>().
FirstOrDefault
()
...
...
@@ -146,7 +145,7 @@ namespace Plus.Reflection
/// <param name="memberInfo">MemberInfo</param>
/// <param name="defaultValue">Default value (null as default)</param>
/// <param name="inherit">Inherit attribute from base classes</param>
public
static
TAttribute
GetSingleAttributeOrDefault
<
TAttribute
>(
MemberInfo
memberInfo
,
TAttribute
defaultValue
=
default
(
TAttribute
)
,
bool
inherit
=
true
)
public
static
TAttribute
GetSingleAttributeOrDefault
<
TAttribute
>(
MemberInfo
memberInfo
,
TAttribute
defaultValue
=
default
,
bool
inherit
=
true
)
where
TAttribute
:
Attribute
{
//Get attribute on the member
...
...
src/Plus/Runtime/Caching/CacheExtensions.cs
View file @
e39e6615
...
...
@@ -60,7 +60,7 @@ namespace Plus.Runtime.Caching
var
value
=
await
cache
.
GetAsync
(
key
.
ToString
(),
async
(
keyAsString
)
=>
{
var
v
=
await
factory
(
key
);
return
v
;
return
(
object
)
v
;
});
return
(
TValue
)
value
;
...
...
@@ -73,7 +73,7 @@ namespace Plus.Runtime.Caching
return
cache
.
GetAsync
(
key
.
ToString
(),
async
(
keyAsString
)
=>
{
var
v
=
await
factory
(
key
);
return
v
;
return
(
object
)
v
;
});
});
var
values
=
await
Task
.
WhenAll
(
tasks
);
...
...
src/Plus/Runtime/Caching/CacheKeyAttribute.cs
0 → 100644
View file @
e39e6615
using
System
;
namespace
Plus.Runtime.Caching
{
[
AttributeUsage
(
AttributeTargets
.
Method
)]
public
class
CacheKeyAttribute
:
Attribute
{
public
string
Name
{
get
;
private
set
;
}
public
string
Format
{
get
;
private
set
;
}
public
string
Description
{
get
;
private
set
;
}
public
CacheKeyAttribute
(
string
name
,
string
description
)
:
this
(
name
,
""
,
description
)
{
}
public
CacheKeyAttribute
(
string
name
,
string
format
,
string
description
)
{
Name
=
name
;
Format
=
format
;
Description
=
description
;
}
public
string
GetLocalizedKey
(
params
object
[]
args
)
{
string
text
=
Name
;
if
(!
string
.
IsNullOrEmpty
(
Format
))
{
text
=
text
+
"["
+
Format
;
int
num
=
0
;
foreach
(
object
obj
in
args
)
{
text
=
text
.
Replace
(
"{"
+
num
+
"}"
,
(
obj
!=
null
)
?
obj
.
ToString
()
:
""
);
num
++;
}
text
+=
"]"
;
}
return
text
;
}
}
}
\ No newline at end of file
src/Plus/Runtime/Caching/CachingAttribute.cs
0 → 100644
View file @
e39e6615
using
System
;
namespace
Plus.Runtime.Caching
{
[
AttributeUsage
(
AttributeTargets
.
Method
,
AllowMultiple
=
false
,
Inherited
=
false
)]
public
class
CachingAttribute
:
Attribute
{
public
string
CacheManagerProviderServiceName
{
get
;
set
;
}
public
CachingBehavior
Behavior
{
get
;
set
;
}
public
string
[]
MethodNames
{
get
;
set
;
}
public
CachingAttribute
()
:
this
(
""
,
CachingBehavior
.
Get
,
(
string
[])
null
)
{
}
public
CachingAttribute
(
string
cacheManagerProviderServiceName
,
CachingBehavior
behavior
)
:
this
(
cacheManagerProviderServiceName
,
behavior
,
(
string
[])
null
)
{
}
public
CachingAttribute
(
string
cacheManagerProviderServiceName
,
CachingBehavior
behavior
,
params
string
[]
methodNames
)
{
Behavior
=
behavior
;
CacheManagerProviderServiceName
=
cacheManagerProviderServiceName
;
MethodNames
=
methodNames
;
}
}
}
\ No newline at end of file
src/Plus/Runtime/Caching/CachingBehavior.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Runtime.Caching
{
public
enum
CachingBehavior
{
Get
,
Set
,
Remove
}
}
\ No newline at end of file
src/Plus/Runtime/Caching/CachingHelper.cs
0 → 100644
View file @
e39e6615
using
System.Reflection
;
namespace
Plus.Runtime.Caching
{
public
class
CachingHelper
{
public
static
bool
HasCachingAttribute
(
MemberInfo
methodInfo
)
{
return
methodInfo
.
IsDefined
(
typeof
(
CachingAttribute
),
inherit
:
true
);
}
}
}
\ No newline at end of file
src/Plus/Runtime/Caching/TypedCacheExtensions.cs
View file @
e39e6615
...
...
@@ -10,12 +10,12 @@ namespace Plus.Runtime.Caching
{
public
static
TValue
Get
<
TKey
,
TValue
>(
this
ITypedCache
<
TKey
,
TValue
>
cache
,
TKey
key
,
Func
<
TValue
>
factory
)
{
return
cache
.
Get
(
key
,
k
=>
factory
());
return
cache
.
Get
(
key
,
(
TKey
k
)
=>
factory
());
}
public
static
Task
<
TValue
>
GetAsync
<
TKey
,
TValue
>(
this
ITypedCache
<
TKey
,
TValue
>
cache
,
TKey
key
,
Func
<
Task
<
TValue
>>
factory
)
{
return
cache
.
GetAsync
(
key
,
k
=>
factory
());
return
cache
.
GetAsync
(
key
,
(
TKey
k
)
=>
factory
());
}
}
}
\ No newline at end of file
src/Plus/Services/ApplicationServiceBase.cs
View file @
e39e6615
...
...
@@ -6,17 +6,9 @@ namespace Plus.Services
{
public
abstract
class
ApplicationServiceBase
:
IApplicationService
,
ITransientDependency
{
public
ILogger
Logger
{
protected
get
;
set
;
}
public
ILogger
Logger
{
protected
get
;
set
;
}
public
IEventPublisher
EventPublisher
{
protected
get
;
set
;
}
public
IEventPublisher
EventPublisher
{
protected
get
;
set
;
}
protected
ApplicationServiceBase
()
{
...
...
src/Plus/Services/Dto/AuditedEntityDto.cs
0 → 100644
View file @
e39e6615
using
Plus.Domain.Entities.Auditing
;
using
System
;
namespace
Plus.Services.Dto
{
[
Serializable
]
public
abstract
class
AuditedEntityDto
:
AuditedEntityDto
<
int
>
{
}
[
Serializable
]
public
abstract
class
AuditedEntityDto
<
TPrimaryKey
>
:
CreationAuditedEntityDto
<
TPrimaryKey
>,
IAudited
,
ICreationAudited
,
IHasCreationTime
,
IModificationAudited
,
IHasModificationTime
{
public
DateTime
?
LastModificationTime
{
get
;
set
;
}
public
long
?
LastModifierUserId
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Services/Dto/ComboboxItemDto.cs
0 → 100644
View file @
e39e6615
using
System
;
namespace
Plus.Services.Dto
{
[
Serializable
]
public
class
ComboboxItemDto
:
IDto
{
public
string
Value
{
get
;
set
;
}
public
string
DisplayText
{
get
;
set
;
}
public
bool
IsSelected
{
get
;
set
;
}
public
ComboboxItemDto
()
{
}
public
ComboboxItemDto
(
string
value
,
string
displayText
)
{
Value
=
value
;
DisplayText
=
displayText
;
}
}
}
\ No newline at end of file
src/Plus/Services/Dto/CreationAuditedEntityDto.cs
0 → 100644
View file @
e39e6615
using
Plus.Domain.Entities.Auditing
;
using
System
;
namespace
Plus.Services.Dto
{
[
Serializable
]
public
abstract
class
CreationAuditedEntityDto
:
CreationAuditedEntityDto
<
int
>
{
}
[
Serializable
]
public
abstract
class
CreationAuditedEntityDto
<
TPrimaryKey
>
:
EntityDto
<
TPrimaryKey
>,
ICreationAudited
,
IHasCreationTime
{
public
DateTime
CreationTime
{
get
;
set
;
}
public
long
?
CreatorUserId
{
get
;
set
;
}
protected
CreationAuditedEntityDto
()
{
CreationTime
=
DateTime
.
Now
;
}
}
}
\ No newline at end of file
src/Plus/Services/Dto/EntityRequestInput.cs
0 → 100644
View file @
e39e6615
using
System
;
namespace
Plus.Services.Dto
{
[
Serializable
]
public
class
EntityRequestInput
<
TPrimaryKey
>
:
EntityDto
<
TPrimaryKey
>,
IInputDto
,
IDto
{
public
EntityRequestInput
()
{
}
public
EntityRequestInput
(
TPrimaryKey
id
)
:
base
(
id
)
{
}
}
}
\ No newline at end of file
src/Plus/Services/Dto/EntityResultOutput.cs
0 → 100644
View file @
e39e6615
using
System
;
namespace
Plus.Services.Dto
{
[
Serializable
]
public
class
EntityResultOutput
:
EntityResultOutput
<
int
>,
IEntityDto
,
IEntityDto
<
int
>,
IDto
{
public
EntityResultOutput
()
{
}
public
EntityResultOutput
(
int
id
)
:
base
(
id
)
{
}
}
[
Serializable
]
public
class
EntityResultOutput
<
TPrimaryKey
>
:
EntityDto
<
TPrimaryKey
>,
IOutputDto
,
IDto
{
public
EntityResultOutput
()
{
}
public
EntityResultOutput
(
TPrimaryKey
id
)
:
base
(
id
)
{
}
}
}
\ No newline at end of file
src/Plus/Services/Dto/FullAuditedEntityDto.cs
0 → 100644
View file @
e39e6615
using
Plus.Domain.Entities
;
using
Plus.Domain.Entities.Auditing
;
using
System
;
namespace
Plus.Services.Dto
{
[
Serializable
]
public
abstract
class
FullAuditedEntityDto
:
FullAuditedEntityDto
<
int
>
{
}
[
Serializable
]
public
abstract
class
FullAuditedEntityDto
<
TPrimaryKey
>
:
AuditedEntityDto
<
TPrimaryKey
>,
IFullAudited
,
IAudited
,
ICreationAudited
,
IHasCreationTime
,
IModificationAudited
,
IHasModificationTime
,
IDeletionAudited
,
IHasDeletionTime
,
ISoftDelete
{
public
bool
IsDeleted
{
get
;
set
;
}
public
long
?
DeleterUserId
{
get
;
set
;
}
public
DateTime
?
DeletionTime
{
get
;
set
;
}
}
}
\ No newline at end of file
src/Plus/Services/Dto/IDto.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Services.Dto
{
public
interface
IDto
{
}
}
\ No newline at end of file
src/Plus/Services/Dto/IInputDto.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Services.Dto
{
public
interface
IInputDto
:
IDto
{
}
}
\ No newline at end of file
src/Plus/Services/Dto/IOutputDto.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Services.Dto
{
public
interface
IOutputDto
:
IDto
{
}
}
\ No newline at end of file
src/Plus/Services/Dto/IdInput.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Services.Dto
{
public
class
IdInput
:
IdInput
<
int
>
{
public
IdInput
()
{
}
public
IdInput
(
int
id
)
:
base
(
id
)
{
}
}
public
class
IdInput
<
TId
>
:
IInputDto
,
IDto
{
public
TId
Id
{
get
;
set
;
}
public
IdInput
()
{
}
public
IdInput
(
TId
id
)
{
Id
=
id
;
}
}
}
\ No newline at end of file
src/Plus/Services/Dto/NullableIdInput.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Services.Dto
{
public
class
NullableIdInput
:
NullableIdInput
<
int
>
{
public
NullableIdInput
()
{
}
public
NullableIdInput
(
int
?
id
)
:
base
(
id
)
{
}
}
public
class
NullableIdInput
<
TId
>
:
IInputDto
,
IDto
where
TId
:
struct
{
public
TId
?
Id
{
get
;
set
;
}
public
NullableIdInput
()
{
}
public
NullableIdInput
(
TId
?
id
)
{
Id
=
id
;
}
}
}
\ No newline at end of file
src/Plus/Services/Dto/PagedResultOutput.cs
0 → 100644
View file @
e39e6615
using
System
;
using
System.Collections.Generic
;
namespace
Plus.Services.Dto
{
[
Serializable
]
public
class
PagedResultOutput
<
T
>
:
PagedResultDto
<
T
>,
IOutputDto
,
IDto
{
public
PagedResultOutput
()
{
}
public
PagedResultOutput
(
int
totalCount
,
IReadOnlyList
<
T
>
items
)
:
base
(
totalCount
,
items
)
{
}
}
}
\ No newline at end of file
src/Plus/Services/Dto/TypeDto.cs
0 → 100644
View file @
e39e6615
namespace
Plus.Services.Dto
{
public
class
TypeDto
<
T
>
:
IDto
{
public
T
Value
{
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