zoukankan      html  css  js  c++  java
  • NopCommerce4.2 常见错误及异常处理

    An error occurred while starting the application.

    InvalidOperationException: No field was found backing property 'WeiActivityWinInfos' of entity type 'WeiActivityInfo'. Lazy-loaded navigation properties must have backing fields. Either name the backing field so that it is picked up by convention or configure the backing field to use.

    Microsoft.EntityFrameworkCore.Infrastructure.ModelValidator.ValidateFieldMapping(IModel model)

    InvalidOperationException: No field was found backing property 'WeiActivityWinInfos' of entity type 'WeiActivityInfo'. Lazy-loaded navigation properties must have backing fields. Either name the backing field so that it is picked up by convention or configure the backing field to use.

    出现以上问题,主要是导航属性命名不规范导致的

    错误代码

      public partial class WeiActivityInfo : BaseEntity
        {

            private ICollection<WeiActivityWinInfo> _weiActivityWinInfo;
       
            public virtual ICollection<WeiActivityWinInfo> WeiActivityWinInfos
            {
                get { return _weiActivityWinInfo?? (_weiActivityWinInfo= new List<WeiActivityWinInfo>()); }
                protected set { _weiActivityWinInfo= value; }
            }
        }

     EF 导航配置命名上要保持一致,否则可能到这个错误,正确的配置,保证

    private与public 属性集合名称一致!

    public partial class WeiActivityInfo : BaseEntity
        {

            private ICollection<WeiActivityWinInfo> _weiActivityWinInfos;
       
            public virtual ICollection<WeiActivityWinInfo> WeiActivityWinInfos
            {
                get { return _weiActivityWinInfos?? (_weiActivityWinInfos= new List<WeiActivityWinInfo>()); }
                protected set { _weiActivityWinInfos= value; }
            }
        }

  • 相关阅读:
    RPC 在整个过程中,体现了逐层抽象,将复杂的协议编解码和数据传输封装到了一个函数中
    RPC 框架
    x86寄存器说明
    计算机组成原理—— 寻址方式--
    七种寻址方式(相对基址加变址寻址方式)---寄存器
    什么是寻址方式
    Intel寄存器名称解释及用途,%eax%ebx等都是什么意思
    CPU的内部架构和工作原理
    CPU工作流程
    8086内部寄存器
  • 原文地址:https://www.cnblogs.com/chenyuxi/p/11924760.html
Copyright © 2011-2022 走看看