diff --git a/common.props b/common.props
index 329358f7..938dc549 100644
--- a/common.props
+++ b/common.props
@@ -9,7 +9,7 @@
https://raw.githubusercontent.com/liuhll/silky/main/LICENSE
- 3.8.16
+ 3.8.17
https://raw.githubusercontent.com/liuhll/silky/main/docs/.vuepress/public/assets/logo/logo.png
diff --git a/framework/src/Silky.Rpc/Runtime/Server/ServiceEntry/ServiceEntry.cs b/framework/src/Silky.Rpc/Runtime/Server/ServiceEntry/ServiceEntry.cs
index 7f0e4fc1..55a2cb4b 100644
--- a/framework/src/Silky.Rpc/Runtime/Server/ServiceEntry/ServiceEntry.cs
+++ b/framework/src/Silky.Rpc/Runtime/Server/ServiceEntry/ServiceEntry.cs
@@ -116,7 +116,6 @@ private void CreateCachingInterceptorDescriptors()
{
foreach (var cacheKey in parameterDescriptor.CacheKeys)
{
-
if (!cacheKey.Key.Equals(cachingInterceptorProvider.KeyTemplate))
{
continue;
@@ -125,17 +124,17 @@ private void CreateCachingInterceptorDescriptors()
foreach (var cacheKeyProvider in cacheKey.Value)
{
cachingInterceptorDescriptor
- .CacheKeyProviderDescriptors
- .Add(new CacheKeyProviderDescriptor()
- {
- PropName = cacheKeyProvider.PropName,
- Index = cacheKeyProvider.Index,
- CacheKeyType = cacheKeyProvider.CacheKeyType,
- ParameterIndex = parameterDescriptor.Index,
- From = parameterDescriptor.From,
- IsSampleOrNullableType = parameterDescriptor.IsSingleType,
- IsNullableType = parameterDescriptor.IsNullableType,
- });
+ .CacheKeyProviderDescriptors
+ .Add(new CacheKeyProviderDescriptor()
+ {
+ PropName = cacheKeyProvider.PropName,
+ Index = cacheKeyProvider.Index,
+ CacheKeyType = cacheKeyProvider.CacheKeyType,
+ ParameterIndex = parameterDescriptor.Index,
+ From = parameterDescriptor.From,
+ IsSampleOrNullableType = parameterDescriptor.IsSingleType,
+ IsNullableType = parameterDescriptor.IsNullableType,
+ });
}
}
}
@@ -342,7 +341,7 @@ private void CreateFallBackExecutor()
private void CreateDefaultSupportedResponseMediaTypes()
{
- if (!this.NeedHttpProtocolSupport() && (ReturnType != null || ReturnType == typeof(void)))
+ if (!this.ActionResultSupport() && (ReturnType != null || ReturnType == typeof(void)))
{
SupportedResponseMediaTypes.Add("application/json");
SupportedResponseMediaTypes.Add("text/json");
@@ -351,7 +350,7 @@ private void CreateDefaultSupportedResponseMediaTypes()
private void CreateDefaultSupportedRequestMediaTypes()
{
- if (Parameters.Any(p => p.From == ParameterFrom.Form) || this.NeedHttpProtocolSupport())
+ if (Parameters.Any(p => p.From == ParameterFrom.Form) || this.HasFileParameter())
{
SupportedRequestMediaTypes.Add("multipart/form-data");
}
diff --git a/framework/src/Silky.Rpc/Runtime/Server/ServiceEntry/ServiceEntryExtensions.cs b/framework/src/Silky.Rpc/Runtime/Server/ServiceEntry/ServiceEntryExtensions.cs
index c4881742..521210d5 100644
--- a/framework/src/Silky.Rpc/Runtime/Server/ServiceEntry/ServiceEntryExtensions.cs
+++ b/framework/src/Silky.Rpc/Runtime/Server/ServiceEntry/ServiceEntryExtensions.cs
@@ -181,10 +181,10 @@ public static IRemoveMatchKeyCachingInterceptProvider[]
public static bool NeedHttpProtocolSupport(this ServiceEntry serviceEntry)
{
- // if (typeof(IActionResult).IsAssignableFrom(serviceEntry.ReturnType))
- // {
- // return true;
- // }
+ if (typeof(IActionResult).IsAssignableFrom(serviceEntry.ReturnType))
+ {
+ return true;
+ }
foreach (var parameterDescriptor in serviceEntry.Parameters)
{
@@ -197,6 +197,29 @@ public static bool NeedHttpProtocolSupport(this ServiceEntry serviceEntry)
return false;
}
+ public static bool ActionResultSupport(this ServiceEntry serviceEntry)
+ {
+ if (typeof(IActionResult).IsAssignableFrom(serviceEntry.ReturnType))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static bool HasFileParameter(this ServiceEntry serviceEntry)
+ {
+ foreach (var parameterDescriptor in serviceEntry.Parameters)
+ {
+ if (parameterDescriptor.IsSupportFileParameter())
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
public static bool IsSilkyAppService(this ServiceEntry serviceEntry)
{
return "Silky.Http.Dashboard.AppService.ISilkyAppService".Equals(serviceEntry.ServiceType.FullName);
diff --git a/templates/app/content/common.props b/templates/app/content/common.props
index 0285322a..ffad33ad 100644
--- a/templates/app/content/common.props
+++ b/templates/app/content/common.props
@@ -2,6 +2,6 @@
true
$(NoWarn);1591
- 3.8.16
+ 3.8.17
\ No newline at end of file