/// <summary>验证并修补数据,通过抛出异常的方式提示验证失败。</summary> /// <param name="isNew">是否插入</param> public override void Valid(Boolean isNew) { // 如果没有脏数据,则不需要进行任何处理 if (!HasDirty) { return; } if (!Version.IsNullOrEmpty() && !Dirtys[nameof(Compile)]) { Compile = AssemblyX.GetCompileTime(Version); } }
public void GetCompileTime() { { var ver = "2.0.8153.37437"; var time = AssemblyX.GetCompileTime(ver); Assert.Equal("2022-04-28 20:47:54".ToDateTime(), time); } { var ver = "9.0.2022.427"; var time = AssemblyX.GetCompileTime(ver); Assert.Equal("2022-04-27 00:00:00".ToDateTime(), time); } { var ver = "9.0.2022.0427-beta0344"; var time = AssemblyX.GetCompileTime(ver); Assert.Equal("2022-04-27 11:44:00".ToDateTime(), time); } }