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.
Connected.Framework/Connected.Entities/Annotations/PersistenceAttribute.cs

23 lines
754 B

namespace Connected.Entities.Annotations
{
[Flags]
public enum ColumnPersistence
{
InMemory = 0,
Read = 1,
Write = 2,
ReadWrite = 3
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)]
public sealed class PersistenceAttribute : Attribute
{
public ColumnPersistence Persistence { get; set; }
public bool IsReadOnly => (Persistence & ColumnPersistence.Read) == ColumnPersistence.Read;
public bool IsWriteOnly => (Persistence & ColumnPersistence.Write) == ColumnPersistence.Write;
public bool IsReadWrite => (Persistence & ColumnPersistence.ReadWrite) == ColumnPersistence.ReadWrite;
public bool IsVirtual => Persistence == ColumnPersistence.InMemory;
}
}