You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel.SQL/Contracts/BaseVersionedEntity.cs

56 lines
1.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Runtime.Serialization;
namespace ZeroLevel.SqlServer
{
[DataContract]
[Serializable]
public abstract class BaseVersionedEntity : BaseEntity, IVersionedEntity
{
#region Properties
[DataMember]
[DbMember(false)]
public long Version
{
get;
internal set;
}
#endregion
#region Ctors
protected BaseVersionedEntity()
: base()
{
}
// Конструктор protected BaseVersionedEntity(Guid id) исключен, т.к. без версии нет смысла создавать обхект с известным ID
protected BaseVersionedEntity(Guid id, long version)
: base(id)
{
Version = version;
}
protected BaseVersionedEntity(BaseVersionedEntity other)
: base(other)
{
Version = other.Version;
}
#endregion
public bool Equals(BaseVersionedEntity other)
{
if (base.Equals(other) == false) return false;
return Version == other.Version;
}
public override bool Equals(object obj)
{
return Equals(obj as BaseVersionedEntity);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}

Powered by TurnKey Linux.