using System; using System.Linq.Expressions; using System.Windows.Media; using InABox.Configuration; using InABox.Core; using RoslynPad.Editor; namespace PRSDesktop { public interface IModel { Guid ID { get; } } public abstract class Model : IModel where TModel: Model where TEntity : Entity { public Guid ID { get; } public abstract Columns GetColumns(); public static Columns Columns => (Activator.CreateInstance(typeof(TModel), new object[] { null }) as Model).GetColumns(); public CoreRow? Row { get; } protected TType? Get(Expression> property) => Row != null ? Row.Get(property) : default(TType); public Model(CoreRow row) { Row = row; ID = Get(x => x.ID); } } }