Nhibernate 中或者符号Or 的用法

        /// <summary>
        /// 根据机组编号、测点类型获取数据
        /// </summary>
        /// <param name="unitNumber"></param>
        /// <param name="tagtype"></param>
        /// <returns></returns>
        public IList<USSGS_EquStateTag> GetStateTagByUnitNodeidState(string unitNumber, string nodeid, string state)
        {
            if (dataBaseSession == null)
            {
                throw new ApplicationException("连接数据库失败");
            }
            ICriteria criteria = dataBaseSession.CreateCriteria(typeof(USSGS_EquStateTag));
            if (!string.IsNullOrEmpty(unitNumber))
            {
                criteria.Add(Restrictions.Eq("JZBH", unitNumber));
            }
            if (!string.IsNullOrEmpty(nodeid))
            {
                criteria.Add(Restrictions.Eq("NodeID", nodeid)).AddOrder(new Order("ByOrder", true));
            }

    //或者符号 Or 的用法如下:           

     criteria.Add(Restrictions.Or(Restrictions.Eq("State", state),Restrictions.IsNull("State")));
            return criteria.List<USSGS_EquStateTag>();
        }

原文地址:https://www.cnblogs.com/yisheng/p/2743976.html