果糖网

查询时报字段不存在 返回

SqlSugar
3 92

public class Customer

    {

        /// <summary>

        /// 

        /// </summary>

        public Customer()

        {

        }


        private System.String _CompanyId;

        /// <summary>

        /// 

        /// </summary>

        public System.String CompanyId { get { return this._CompanyId; } set { this._CompanyId = value; } }


        private System.String _CustomerId;


        private System.String _CompanyName;

        /// <summary>

        /// 公司名(虚拟键)

        /// </summary>

        [SugarColumn(IsOnlyIgnoreInsert  = true,IsOnlyIgnoreUpdate =true)]

        public System.String CompanyName { get { return this._CompanyName; } set { this._CompanyName = value; } } 


        /// <summary>

        /// 

        /// </summary>

        public System.String CustomerId { get { return this._CustomerId; } set { this._CustomerId = value; } }


        private System.String _CustomerName;

        /// <summary>

        /// 

        /// </summary>

        public System.String CustomerName { get { return this._CustomerName; } set { this._CustomerName = value; } }


        private System.String _CustomerState;

        /// <summary>

        /// 

        /// </summary>

        public System.String CustomerState { get { return this._CustomerState; } set { this._CustomerState = value; } }


        private System.String _IdNo;

        /// <summary>

        /// 

        /// </summary>

        public System.String IdNo { get { return this._IdNo; } set { this._IdNo = value; } }


        private System.String _Addr;

        /// <summary>

        /// 

        /// </summary>

        public System.String Addr { get { return this._Addr; } set { this._Addr = value; } }


        private System.String _Phone;

        /// <summary>

        /// 

        /// </summary>

        public System.String Phone { get { return this._Phone; } set { this._Phone = value; } }


        private System.DateTime? _OpenDate;

        /// <summary>

        /// 

        /// </summary>

        public System.DateTime? OpenDate { get { return this._OpenDate; } set { this._OpenDate = value; } }


        private System.Int32? _MeterNum;

        /// <summary>

        /// 

        /// </summary>

        public System.Int32? MeterNum { get { return this._MeterNum; } set { this._MeterNum = value; } }


        private System.Decimal? _Balance;

        /// <summary>

        /// 

        /// </summary>

        public System.Decimal? Balance { get { return this._Balance; } set { this._Balance = value; } }


        private System.String _Remark;

        /// <summary>

        /// 

        /// </summary>

        public System.String Remark { get { return this._Remark; } set { this._Remark = value; } }


        private System.String _WechatName;

        /// <summary>

        /// 

        /// </summary>

        public System.String WechatName { get { return this._WechatName; } set { this._WechatName = value; } }


        private System.String _WechatOpenId;

        /// <summary>

        /// 

        /// </summary>

        public System.String WechatOpenId { get { return this._WechatOpenId; } set { this._WechatOpenId = value; } }


        private System.String _UpdateMan;

        /// <summary>

        /// 

        /// </summary>

        public System.String UpdateMan { get { return this._UpdateMan; } set { this._UpdateMan = value; } }


        private System.DateTime? _UpdateTime;

        /// <summary>

        /// 

        /// </summary>

        public System.DateTime? UpdateTime { get { return this._UpdateTime; } set { this._UpdateTime = value; } }

    }




List<AppEntity.Customer> Customers = DbSugar.Instance.Queryable<AppEntity.Customer, AppEntity.Company>((bt, cm) => new object[] {

                    JoinType.Left, bt.CompanyId == cm.CompanyId })

                    .Where(bt => bt.CompanyId == ashxRequest.ClientRequestUser.Company.CompanyId)

                    .Select<AppEntity.Customer>().ToList();


热忱回答3

  • 报CompanyName不 存在,在4.x是可以的。好像[SugarColumn(IsOnlyIgnoreInsert  = true,IsOnlyIgnoreUpdate =true)]没生效?

    0 回复
  • 从4.x升级到5,代码中有大量类似的情况,除了用viewmodel,还有更好的方法吗?

    0 回复
  • 用 isignore=true ,你查询用到了这个字段 

    0 回复

学习文档