mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Modify validation logic
This commit is contained in:
@@ -620,21 +620,21 @@ namespace SqlSugar
|
|||||||
Check.Exception(dbVersion == null, "UpdateVersionValidation database column {0} is not null", versionColumn.DbColumnName);
|
Check.Exception(dbVersion == null, "UpdateVersionValidation database column {0} is not null", versionColumn.DbColumnName);
|
||||||
if (versionColumn.PropertyInfo.PropertyType.IsIn(UtilConstants.IntType, UtilConstants.LongType))
|
if (versionColumn.PropertyInfo.PropertyType.IsIn(UtilConstants.IntType, UtilConstants.LongType))
|
||||||
{
|
{
|
||||||
if (Convert.ToInt64(dbVersion) > Convert.ToInt64(currentVersion))
|
if (Convert.ToInt64(dbVersion) != Convert.ToInt64(currentVersion))
|
||||||
{
|
{
|
||||||
throw new VersionExceptions(string.Format("UpdateVersionValidation {0} Not the latest version ", versionColumn.PropertyName));
|
throw new VersionExceptions(string.Format("UpdateVersionValidation {0} Not the latest version ", versionColumn.PropertyName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (versionColumn.PropertyInfo.PropertyType.IsIn(UtilConstants.DateType))
|
else if (versionColumn.PropertyInfo.PropertyType.IsIn(UtilConstants.DateType))
|
||||||
{
|
{
|
||||||
if (dbVersion.ObjToDate() > currentVersion.ObjToDate())
|
if (dbVersion.ObjToDate() != currentVersion.ObjToDate())
|
||||||
{
|
{
|
||||||
throw new VersionExceptions(string.Format("UpdateVersionValidation {0} Not the latest version ", versionColumn.PropertyName));
|
throw new VersionExceptions(string.Format("UpdateVersionValidation {0} Not the latest version ", versionColumn.PropertyName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (versionColumn.PropertyInfo.PropertyType.IsIn(UtilConstants.ByteArrayType))
|
else if (versionColumn.PropertyInfo.PropertyType.IsIn(UtilConstants.ByteArrayType))
|
||||||
{
|
{
|
||||||
if (UtilMethods.GetLong((byte[])dbVersion) > UtilMethods.GetLong((byte[])currentVersion))
|
if (UtilMethods.GetLong((byte[])dbVersion) != UtilMethods.GetLong((byte[])currentVersion))
|
||||||
{
|
{
|
||||||
throw new VersionExceptions(string.Format("UpdateVersionValidation {0} Not the latest version ", versionColumn.PropertyName));
|
throw new VersionExceptions(string.Format("UpdateVersionValidation {0} Not the latest version ", versionColumn.PropertyName));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user