diff --git a/Source/Euonia.Business/Core/BusinessObject.cs b/Source/Euonia.Business/Core/BusinessObject.cs
index 216c94f..883b259 100644
--- a/Source/Euonia.Business/Core/BusinessObject.cs
+++ b/Source/Euonia.Business/Core/BusinessObject.cs
@@ -312,7 +312,7 @@ protected void PropertyHasChanged(string propertyName)
///
/// Checks if the object has changed properties.
///
- public virtual bool HasChangedProperties => ChangedProperties.Any();
+ public virtual bool HasChangedProperties => ChangedProperties.Count > 0;
#endregion
@@ -670,7 +670,7 @@ private object LoadPropertyByReflection(string methodName, IPropertyInfo propert
///
///
///
- private static bool ValuesDiffer(IPropertyInfo propertyInfo, TValue newValue, TValue oldValue)
+ protected virtual bool ValuesDiffer(IPropertyInfo propertyInfo, TValue newValue, TValue oldValue)
{
bool valuesDiffer;
if (oldValue == null)
@@ -679,14 +679,14 @@ private static bool ValuesDiffer(IPropertyInfo propertyInfo, TValue newV
}
else
{
- // use reference equals for objects that inherit from CSLA base class
+ // use reference equals for objects that inherit from base class
if (typeof(IBusinessObject).IsAssignableFrom(propertyInfo.Type))
{
valuesDiffer = !(ReferenceEquals(oldValue, newValue));
}
else
{
- valuesDiffer = !(oldValue.Equals(newValue));
+ valuesDiffer = !EqualityComparer.Default.Equals(newValue, oldValue);
}
}
diff --git a/Source/Euonia.Business/Core/EditableObject.cs b/Source/Euonia.Business/Core/EditableObject.cs
index 4bff769..af9a810 100644
--- a/Source/Euonia.Business/Core/EditableObject.cs
+++ b/Source/Euonia.Business/Core/EditableObject.cs
@@ -373,14 +373,20 @@ protected void SetProperty(string propertyName, ref TValue field, TValue
if (field == null)
{
if (newValue != null)
+ {
doChange = true;
+ }
}
else
{
if (typeof(TValue) == typeof(string) && newValue == null)
+ {
newValue = TypeHelper.CoerceValue(typeof(string), string.Empty);
- if (!field.Equals(newValue))
+ }
+ if (ValuesDiffer(propertyInfo, newValue, field))
+ {
doChange = true;
+ }
}
if (doChange)
diff --git a/Source/Euonia.Business/Factory/BusinessObjectFactory.cs b/Source/Euonia.Business/Factory/BusinessObjectFactory.cs
index b7981b3..8fd09b8 100644
--- a/Source/Euonia.Business/Factory/BusinessObjectFactory.cs
+++ b/Source/Euonia.Business/Factory/BusinessObjectFactory.cs
@@ -131,11 +131,10 @@ public async Task SaveAsync(TTarget target, CancellationToken
}
///
- public async Task ExecuteAsync(TTarget command, CancellationToken cancellationToken = default)
+ public async Task ExecuteAsync(TTarget target, CancellationToken cancellationToken = default)
where TTarget : ICommandObject
{
var method = ObjectReflector.FindFactoryMethod(new object[] { cancellationToken });
- var target = GetObjectInstance();
try
{
diff --git a/Source/Euonia.Business/Factory/IObjectFactory.cs b/Source/Euonia.Business/Factory/IObjectFactory.cs
index 612a118..16c797c 100644
--- a/Source/Euonia.Business/Factory/IObjectFactory.cs
+++ b/Source/Euonia.Business/Factory/IObjectFactory.cs
@@ -80,13 +80,13 @@ public interface IObjectFactory
/// Invoke the execute method of an exists command object of .
///
/// Type of the target object.
- ///
+ ///
///
///
///
/// The method should named as Execute, ExecuteAsync, FactoryExecute, FactoryExecuteAsync, or attributed use .
///
- Task ExecuteAsync(TTarget command, CancellationToken cancellationToken = default)
+ Task ExecuteAsync(TTarget target, CancellationToken cancellationToken = default)
where TTarget : ICommandObject;
///
diff --git a/project.props b/project.props
index 54d7d86..a7f93a1 100644
--- a/project.props
+++ b/project.props
@@ -1,6 +1,6 @@
- 8.1.19
+ 8.1.20
damon
Nerosoft Ltd.
Euonia