baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
Executable
+65
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Domain
|
||||
{
|
||||
public abstract class EntityInt64 : Entity, IEntity<Int64>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return Equals(obj as EntityInt64);
|
||||
}
|
||||
|
||||
private static bool IsTransient(EntityInt64 obj)
|
||||
{
|
||||
return obj != null && Equals(obj.Id, default(long));
|
||||
}
|
||||
|
||||
private Type GetUnproxiedType()
|
||||
{
|
||||
return GetType();
|
||||
}
|
||||
|
||||
public virtual bool Equals(EntityInt64 other)
|
||||
{
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
if (ReferenceEquals(this, other))
|
||||
return true;
|
||||
|
||||
if (!IsTransient(this) &&
|
||||
!IsTransient(other) &&
|
||||
Equals(Id, other.Id))
|
||||
{
|
||||
var otherType = other.GetUnproxiedType();
|
||||
var thisType = GetUnproxiedType();
|
||||
return thisType.IsAssignableFrom(otherType) ||
|
||||
otherType.IsAssignableFrom(thisType);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
if (Equals(Id, default(long)))
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
return Id.GetHashCode();
|
||||
}
|
||||
|
||||
public static bool operator ==(EntityInt64 x, EntityInt64 y)
|
||||
{
|
||||
return Equals(x, y);
|
||||
}
|
||||
|
||||
public static bool operator !=(EntityInt64 x, EntityInt64 y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user