ModelContext三级继承没有效果 返回

SqlSugar 老数据
3 2605

由于有几个实体字段是通用的,所以就建了个基类,现在基类继承ModelContext,ModelContext中的Context总是Null,总是报SqlSugarException.ArgumentNullException:Please use Sqlugar.ModelContext这个错误,子类直接继承ModelContext一切正常,

热忱回答3

  • 看了下源码


                    if (entityType.GetTypeInfo().BaseType.HasValue() && entityType.GetTypeInfo().BaseType == UtilConstants.ModelType)

                    {

                        foreach (var item in result)

                        {

                            var contextProperty = item.GetType().GetProperty("Context");

                            SqlSugarClient newClient = this.Context.Utilities.CopyContext();

                            contextProperty.SetValue(item, newClient, null);

                        }

                    }

    好像红色代码造成的

    0 回复
  • 考虑下个版本支持

    0 回复
  • @fate stay night:什么时候更新呢?

    0 回复