Exemple #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);
        }
Exemple #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);
        }
Exemple #3
0
 /// <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);
 }
Exemple #4
0
        /// <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);
        }