当前位置: 首页 > news >正文

网站建设与制作企业用wordpress插件推荐

网站建设与制作企业,用wordpress插件推荐,关于建设网站的图片,正规网站建设推荐efcore 新特性 SaveChanges EventsIntro昨天早上看到之前关注的一个 efcore 的 issue 被 closed #xff0c;于是看了一眼#xff0c; ef core 新合并了一个 PR#xff0c;在 DbContext 中增加了 SaveChanges 相关的几个事件#xff0c;具体的变更可以参数 PR https://gith… efcore 新特性 SaveChanges EventsIntro昨天早上看到之前关注的一个 efcore 的 issue 被 closed 于是看了一眼 ef core 新合并了一个 PR在 DbContext 中增加了 SaveChanges 相关的几个事件具体的变更可以参数 PR https://github.com/dotnet/efcore/pull/21862Events之前写过两篇关于 EF Core 做自动审计的文章第一次的实现需要显式继承一个 AuditDbContext 在有些需要没办法修改 DbContext 或者原有 DbContext 已经有继承某一个类就没有办法用了可以参考 EF Core 数据变更自动审计设计后面结合 AOP 改进了一版通过一个审计切面逻辑完成自动审计但是需要引入 AOP 组件支持对于不想引入额外组件的项目来说也并非特别友好可以参考 打造更好用的 EF 自动审计在这个 PR 合并之后我们可以通过 SavingChanges 事件获取保存之前 DbContext 的状态通过 SavedChanges 事件来获取保存成功后的 DbContext 信息SaveChangesFailed 事件获取保存失败信息事件定义如下 /// summary ///     An event fired at the beginning of a call to see crefM:SaveChanges/ or see crefM:SaveChangesAsync/ /// /summary public event EventHandlerSavingChangesEventArgs SavingChanges;/// summary ///     An event fired at the end of a call to see crefM:SaveChanges/ or see crefM:SaveChangesAsync/ /// /summary public event EventHandlerSavedChangesEventArgs SavedChanges;/// summary ///     An event fired if a call to see crefM:SaveChanges/ or see crefM:SaveChangesAsync/ fails with an exception. /// /summary public event EventHandlerSaveChangesFailedEventArgs SaveChangesFailed; 事件参数定义如下/// summary ///     Base event arguments for the see crefM:DbContext.SaveChanges / and see crefM:DbContext.SaveChangesAsync / events. /// /summary public abstract class SaveChangesEventArgs : EventArgs {/// summary///     Creates a base event arguments instance for see crefM:DbContext.SaveChanges ////     or see crefM:DbContext.SaveChangesAsync / events./// /summary/// param nameacceptAllChangesOnSuccess The value passed to SaveChanges. /paramprotected SaveChangesEventArgs(bool acceptAllChangesOnSuccess){AcceptAllChangesOnSuccess  acceptAllChangesOnSuccess;}/// summary///     The value passed to see crefM:DbContext.SaveChanges / or see crefM:DbContext.SaveChangesAsync /./// /summarypublic virtual bool AcceptAllChangesOnSuccess { get; } }/// summary ///     Event arguments for the see crefDbContext.SavingChanges / event. /// /summary public class SavingChangesEventArgs : SaveChangesEventArgs {/// summary///     Creates event arguments for the see crefM:DbContext.SavingChanges / event./// /summary/// param nameacceptAllChangesOnSuccess The value passed to SaveChanges. /parampublic SavingChangesEventArgs(bool acceptAllChangesOnSuccess): base(acceptAllChangesOnSuccess){} }/// summary ///     Event arguments for the see crefDbContext.SavedChanges / event. /// /summary public class SavedChangesEventArgs : SaveChangesEventArgs {/// summary///     Creates a new see crefSavedChangesEventArgs / instance with the given number of entities saved./// /summary/// param nameacceptAllChangesOnSuccess The value passed to SaveChanges. /param/// param nameentitiesSavedCount The number of entities saved. /parampublic SavedChangesEventArgs(bool acceptAllChangesOnSuccess, int entitiesSavedCount) : base(acceptAllChangesOnSuccess){EntitiesSavedCount  entitiesSavedCount;}/// summary///     The number of entities saved./// /summarypublic virtual int EntitiesSavedCount { get; } }/// summary ///     Event arguments for the see crefDbContext.SaveChangesFailed / event. /// /summary public class SaveChangesFailedEventArgs : SaveChangesEventArgs {/// summary/// Creates a new see crefSaveChangesFailedEventArgs/ instance with the exception that was thrown./// /summary/// param nameacceptAllChangesOnSuccess The value passed to SaveChanges. /param/// param nameexception The exception thrown. /parampublic SaveChangesFailedEventArgs(bool acceptAllChangesOnSuccess, [NotNull] Exception exception): base(acceptAllChangesOnSuccess){Exception  exception;}/// summary/// The exception thrown duringsee crefM:DbContext.SaveChanges/ or see crefM:DbContext.SaveChangesAsync/./// /summarypublic virtual Exception Exception { get; } } More除了上面的审计你也可以使用通过这些事件实现保存之前的自动更新数据库字段的值比如 Add 或 Update 操作数据时自动设置更新时间等信息本文提到的特性还未正式发布预计会在 .net5 下一个预览版中发布如果想现在要尝试请使用 efcore 的 daily build 的包可以参考 https://github.com/dotnet/aspnetcore/blob/master/docs/DailyBuilds.mdReferencehttps://github.com/dotnet/efcore/issues/15910https://github.com/dotnet/efcore/pull/21862
http://www.huolong8.cn/news/44352/

相关文章:

  • 怎么从阿里巴巴做网站苏州高新区核酸检测
  • app下载网站建设网络运维是干什么的
  • 直播网站app开发类似于pinterest的设计网站
  • 大连做网站的企业wordpress数据库查询数据库
  • 网站排名首页怎么做给新公司建网站
  • 高端网站建设一般多少钱浏览器搜不到wordpress
  • 搭建网站 开源软件计算机网络实验 做网站的
  • 网站建设与维护是什么内容wordpress菜单分开间隔
  • 怎么看一个网站是由哪个网络公司做的1m带宽可以建设电商网站吗
  • 仿制网站wordpress 用户管理
  • 网站备案证书安装福建鞋子做淘宝图片网站
  • 中国外贸网站有哪些问题wordpress中文没人管了
  • 十堰网站设计公司阿里云 两个网站
  • 源码网站开发网络营销推广组合
  • 建设直播平台网站软件注册一个公司需要几个人
  • html5网站引导页模板网络服务合同需要缴纳印花税吗
  • 互助网站开发wordpress小程序小白
  • 公司网站建立流程色一把做最好网站
  • 网站pc和手机端分离怎么做erp系统是怎样的一个软件
  • 邢台做网站改版seo优化主要工作内容
  • 沈阳网站建设哪家好红河州建设局网站
  • 免费个人网站建站源码昆明网站制作代理
  • 网站开发学校 优帮云郑州网站优化怎样做
  • 网站建设的七大主要目的个人能不能自己做网站
  • 网站建设实训报告范文免费ppt下载网站有哪些
  • 做海报网站公司网站建设的签订合同
  • wordpress最好用的虚拟主机优化手机软件
  • 苏州高端网站建设设计wordpress接入对象存储
  • 金融平台网站开发ps个人网站制作流程
  • 顺义区网站建设手机上怎么分享wordpress