Esempio n. 1
0
        private int CalculateCount(NavProps list)
        {
            if (list == null)
            {
                return(0);
            }
            var totalCount = list.Count;

            foreach (var item in list)
            {
                totalCount += CalculateCount(item.NavProps);
            }
            return(totalCount);
        }
Esempio n. 2
0
        public NavProp SubNavProp <TNavPropEnum>(TNavPropEnum subNavPropEnum) where TNavPropEnum : struct, IComparable, IFormattable, IConvertible
        {
            if (NavProps == null)
            {
                NavProps = new NavProps();
            }
            var navProp = new NavProp <TNavPropEnum>(subNavPropEnum);

            if (NavProps.Contains(navProp))
            {
                return(NavProps.Get(navProp));
            }
            NavProps.Add(navProp);
            return(navProp);
        }
 /// <summary>
 /// Add a Navigation Property Collection to the root level of the query.
 /// </summary>
 /// <returns>
 /// NavPropsBuilder of TPropEnum, TQuery, TQueryBuilder, TNavPropEnum
 /// </returns>
 public NavPropsBuilder <TPropEnum, TQuery, TQueryBuilder, TNavPropEnum> Append(NavProps <TNavPropEnum> props)
 {
     if (!(props?.Count > 0))
     {
         return(this);
     }
     if (NavigationProperties == null)
     {
         NavigationProperties = new NavProps();
     }
     foreach (var np in props)
     {
         NavigationProperties.Add(np);
     }
     return(this);
 }
        /// <summary>
        /// Add a Navigation Property to the root level of the query.
        /// </summary>
        /// <returns>
        /// NavPropsBuilder of TPropEnum, TQuery, TQueryBuilder, TNavPropEnum
        /// </returns>
        public NavPropsBuilder <TPropEnum, TQuery, TQueryBuilder, TNavPropEnum> Append(TNavPropEnum prop)
        {
            if (NavigationProperties == null)
            {
                NavigationProperties = new NavProps();
            }
            var newNavProp = new NavProp <TNavPropEnum>(prop);

            if (_current != null && _current.IntValue == newNavProp.IntValue)
            {
                return(this);
            }
            _current = newNavProp;
            NavigationProperties.Add(newNavProp);
            return(this);
        }