mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-27 05:23:13 +00:00
<>
This commit is contained in:
@ -10,7 +10,6 @@ namespace Esiur.Resource;
|
||||
public class ExportAttribute : Attribute
|
||||
{
|
||||
public string Name { get; private set; } = null;
|
||||
public Type ReturnType { get; private set; } = null;
|
||||
|
||||
public ExportAttribute()
|
||||
{
|
||||
@ -22,16 +21,4 @@ public class ExportAttribute : Attribute
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public ExportAttribute(Type returnType)
|
||||
{
|
||||
ReturnType = returnType;
|
||||
}
|
||||
|
||||
public ExportAttribute(string name, Type returnType)
|
||||
{
|
||||
Name = name;
|
||||
ReturnType = returnType;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -91,17 +91,13 @@ public class FunctionTemplate : MemberTemplate
|
||||
else if (genericRtType == typeof(IEnumerable<>) || genericRtType == typeof(IAsyncEnumerable<>))
|
||||
{
|
||||
// get export
|
||||
rtType = RepresentationType.FromType(mi.GetCustomAttribute<ExportAttribute>()?.ReturnType ?? typeof(object));
|
||||
rtType = RepresentationType.FromType(mi.ReturnType.GetGenericArguments()[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rtType = RepresentationType.FromType(mi.ReturnType);
|
||||
}
|
||||
|
||||
//var rtType = genericRtType == typeof(AsyncReply<>) ?
|
||||
// RepresentationType.FromType(mi.ReturnType.GetGenericArguments()[0]) :
|
||||
// RepresentationType.FromType(mi.ReturnType);
|
||||
|
||||
if (rtType == null)
|
||||
throw new Exception($"Unsupported type `{mi.ReturnType}` in method `{type.Name}.{mi.Name}` return");
|
||||
|
||||
|
Reference in New Issue
Block a user