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/Entity.cs

26 lines
595 B

2 years ago
using Connected.Annotations;
using Connected.Caching.Annotations;
using Connected.Entities.Annotations;
using System.ComponentModel;
using System.Text.Json.Serialization;
namespace Connected.Entities;
public abstract record Entity : IEntity
{
[DefaultValue(State.Default), JsonIgnore, Persistence(Persistence = ColumnPersistence.InMemory)]
public State State { get; init; }
}
public abstract record Entity<T> : Entity, IEntity<T>
where T : notnull
{
protected Entity()
{
Id = default!;
}
[PrimaryKey, CacheKey, ReturnValue, Ordinal(-10000)]
public virtual T Id { get; init; }
}