Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #64

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Source/Euonia.Business/Core/BusinessObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,10 @@ public virtual void LoadProperty(IPropertyInfo propertyInfo, object newValue)
}
else
{
LoadPropertyByReflection("LoadProperty", propertyInfo, newValue);
LoadPropertyByReflection(nameof(LoadProperty), propertyInfo, newValue);
}
#else
LoadPropertyByReflection("LoadProperty", propertyInfo, newValue);
LoadPropertyByReflection(nameof(LoadProperty), propertyInfo, newValue);
#endif
}

Expand All @@ -649,12 +649,12 @@ public virtual void LoadProperty(IPropertyInfo propertyInfo, object newValue)
/// <exception cref="MissingMethodException"></exception>
private object LoadPropertyByReflection(string methodName, IPropertyInfo propertyInfo, object newValue)
{
var t = GetType();
var type = GetType();
const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
var method = t.GetMethods(flags).FirstOrDefault(c => c.Name == methodName && c.IsGenericMethod);
var method = type.GetMethods(flags).FirstOrDefault(c => c.Name == methodName && c.IsGenericMethod);
if (method == null)
{
throw new MissingMethodException(t.FullName, methodName);
throw new MissingMethodException(type.FullName, methodName);
}

var genericMethod = method.MakeGenericMethod(propertyInfo.Type);
Expand Down
25 changes: 17 additions & 8 deletions Source/Euonia.Business/Core/CommandObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class CommandObject<T> : BusinessObject<T>, ICommandObject
where T : CommandObject<T>
where T : CommandObject<T>
{
/// <summary>
/// Execute the command.
/// </summary>
protected internal virtual async Task ExecuteAsync()
{
await Task.CompletedTask;
}
/// <summary>
/// Execute the command.
/// </summary>
protected internal virtual Task ExecuteAsync(CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}

/// <summary>
/// Create new command object.
/// </summary>
/// <returns></returns>
protected internal virtual Task CreateAsync(CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}
}
Loading
Loading