//using System;
//using IRaCIS.Core.Domain.Models;
//using Microsoft.EntityFrameworkCore.ChangeTracking;
//using Microsoft.EntityFrameworkCore.ValueGeneration;

//namespace IRaCIS.Core.Infra.EFCore.ValueGenerator
//{
//    /// <summary>
//    /// 上传监控  时间间隔存储  需要按照这个字段进行排序
//    /// </summary>
//    public class UploadTotalMillisecondsInterval : ValueGenerator<int>
//    {

//        //code first  must  migration    dbfirst  must config  in db and also need config in code
//        //modelBuilder.Entity<StudyMonitor>().Property(e => e.TotalMillisecondsInterval).HasComputedColumnSql("datediff(MS,UploadStartTime,UploadFinishedTime)");

//        //modelBuilder.Entity<StudyMonitor>().Property(e => e.TestInterval).ValueGeneratedOnAddOrUpdate().HasDefaultValueSql("datediff(MS,UploadStartTime,UploadFinishedTime)");

//        public override int Next(EntityEntry entry)
//        {
//            if (entry.Entity is StudyMonitor entity)
//            {
//                return (entity.UploadFinishedTime - entity.UploadStartTime)?.Milliseconds;
//            }
//            else
//            {
//                throw new ArgumentException("ValueGenerator用在了不适合的实体");

//            }
//        }
//        public override bool GeneratesTemporaryValues => false;
//    }
   
//}