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
cf3490ac
Commit
cf3490ac
authored
Aug 22, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete unused fiels.
parent
978ef61d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
140 deletions
+0
-140
ConsumerMethodExecutor.cs
src/DotNetCore.CAP/Internal/ConsumerMethodExecutor.cs
+0
-36
ModelAttributes.cs
src/DotNetCore.CAP/Internal/ModelAttributes.cs
+0
-104
No files found.
src/DotNetCore.CAP/Internal/ConsumerMethodExecutor.cs
deleted
100644 → 0
View file @
978ef61d
using
System.Collections.Generic
;
using
Microsoft.Extensions.Internal
;
namespace
DotNetCore.CAP.Internal
{
public
class
ConsumerMethodExecutor
{
internal
static
object
[]
PrepareArguments
(
IDictionary
<
string
,
object
>
actionParameters
,
ObjectMethodExecutor
actionMethodExecutor
)
{
var
declaredParameterInfos
=
actionMethodExecutor
.
MethodParameters
;
var
count
=
declaredParameterInfos
.
Length
;
if
(
count
==
0
)
{
return
null
;
}
var
arguments
=
new
object
[
count
];
for
(
var
index
=
0
;
index
<
count
;
index
++)
{
var
parameterInfo
=
declaredParameterInfos
[
index
];
object
value
;
if
(!
actionParameters
.
TryGetValue
(
parameterInfo
.
Name
,
out
value
))
{
value
=
actionMethodExecutor
.
GetDefaultValueForParameter
(
index
);
}
arguments
[
index
]
=
value
;
}
return
arguments
;
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Internal/ModelAttributes.cs
deleted
100644 → 0
View file @
978ef61d
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
namespace
DotNetCore.CAP.Internal
{
/// <summary>
/// Provides access to the combined list of attributes associated a <see cref="Type"/> or property.
/// </summary>
public
class
ModelAttributes
{
/// <summary>
/// Creates a new <see cref="ModelAttributes"/> for a <see cref="Type"/>.
/// </summary>
/// <param name="typeAttributes">The set of attributes for the <see cref="Type"/>.</param>
public
ModelAttributes
(
IEnumerable
<
object
>
typeAttributes
)
{
Attributes
=
typeAttributes
?.
ToArray
()
??
throw
new
ArgumentNullException
(
nameof
(
typeAttributes
));
TypeAttributes
=
Attributes
;
}
/// <summary>
/// Creates a new <see cref="ModelAttributes"/> for a property.
/// </summary>
/// <param name="propertyAttributes">The set of attributes for the property.</param>
/// <param name="typeAttributes">
/// The set of attributes for the property's <see cref="Type"/>. See <see cref="PropertyInfo.PropertyType"/>.
/// </param>
public
ModelAttributes
(
IEnumerable
<
object
>
propertyAttributes
,
IEnumerable
<
object
>
typeAttributes
)
{
PropertyAttributes
=
propertyAttributes
?.
ToArray
()
??
throw
new
ArgumentNullException
(
nameof
(
propertyAttributes
));
TypeAttributes
=
typeAttributes
?.
ToArray
()
??
throw
new
ArgumentNullException
(
nameof
(
typeAttributes
));
Attributes
=
PropertyAttributes
.
Concat
(
TypeAttributes
).
ToArray
();
}
/// <summary>
/// Gets the set of all attributes. If this instance represents the attributes for a property, the attributes
/// on the property definition are before those on the property's <see cref="Type"/>.
/// </summary>
public
IReadOnlyList
<
object
>
Attributes
{
get
;
}
/// <summary>
/// Gets the set of attributes on the property, or <c>null</c> if this instance represents the attributes
/// for a <see cref="Type"/>.
/// </summary>
public
IReadOnlyList
<
object
>
PropertyAttributes
{
get
;
}
/// <summary>
/// Gets the set of attributes on the <see cref="Type"/>. If this instance represents a property,
/// then <see cref="TypeAttributes"/> contains attributes retrieved from
/// <see cref="PropertyInfo.PropertyType"/>.
/// </summary>
public
IReadOnlyList
<
object
>
TypeAttributes
{
get
;
}
/// <summary>
/// Gets the attributes for the given <paramref name="property"/>.
/// </summary>
/// <param name="type">The <see cref="Type"/> in which caller found <paramref name="property"/>.
/// </param>
/// <param name="property">A <see cref="PropertyInfo"/> for which attributes need to be resolved.
/// </param>
/// <returns>A <see cref="ModelAttributes"/> instance with the attributes of the property.</returns>
public
static
ModelAttributes
GetAttributesForProperty
(
Type
type
,
PropertyInfo
property
)
{
if
(
type
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
type
));
}
if
(
property
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
property
));
}
var
propertyAttributes
=
property
.
GetCustomAttributes
();
var
typeAttributes
=
property
.
PropertyType
.
GetTypeInfo
().
GetCustomAttributes
();
return
new
ModelAttributes
(
propertyAttributes
,
typeAttributes
);
}
/// <summary>
/// Gets the attributes for the given <paramref name="type"/>.
/// </summary>
/// <param name="type">The <see cref="Type"/> for which attributes need to be resolved.
/// </param>
/// <returns>A <see cref="ModelAttributes"/> instance with the attributes of the <see cref="Type"/>.</returns>
public
static
ModelAttributes
GetAttributesForType
(
Type
type
)
{
if
(
type
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
type
));
}
var
attributes
=
type
.
GetTypeInfo
().
GetCustomAttributes
();
return
new
ModelAttributes
(
attributes
);
}
}
}
\ 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