Skip to content

Commit

Permalink
Merge pull request #64 from NerosoftDev/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Codespilot authored Dec 20, 2023
2 parents 3c55901 + 493571a commit 7449fe8
Show file tree
Hide file tree
Showing 6 changed files with 828 additions and 805 deletions.
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

0 comments on commit 7449fe8

Please sign in to comment.