Beispiel #1
0
        public SelectBuilder PathToList(string path, string propertyName = null, SelectCollectionHandling selectCollectionHandling = SelectCollectionHandling.LeaveAsIs)
        {
            if (propertyName == null)
            {
                propertyName = path.Split('.').LastOrDefault();
            }

            ThrowIfUsedOrEmpty(propertyName);

            Parts.Add(new SelectPart
            {
                Path                     = path,
                PropertyName             = propertyName,
                SelectType               = SelectTypes.PathToList,
                SelectCollectionHandling = selectCollectionHandling
            });

            return(this);
        }
Beispiel #2
0
        public SelectBuilder Aggregate(string path, SelectTypes type, string propertyName = null, SelectCollectionHandling selectCollectionHandling = SelectCollectionHandling.LeaveAsIs)
        {
            if (propertyName == null && path == null)
            {
                throw new Exception("if property name is not specified, a path must be supplied.");
            }

            if (propertyName == null)
            {
                propertyName = path.Split('.').LastOrDefault();
            }

            ThrowIfUsedOrEmpty(propertyName);

            Parts.Add(new SelectPart
            {
                Path                     = path,
                PropertyName             = propertyName,
                SelectType               = type,
                SelectCollectionHandling = selectCollectionHandling
            });

            return(this);
        }
Beispiel #3
0
 public SelectBuilder LastOrDefault(string path, string propertyName = null, SelectCollectionHandling selectCollectionHandling = SelectCollectionHandling.LeaveAsIs)
 => Aggregate(path, SelectTypes.LastOrDefault, propertyName: propertyName, selectCollectionHandling: selectCollectionHandling);
Beispiel #4
0
 public SelectBuilder PathToList(string path, string propertyName = null, SelectCollectionHandling selectCollectionHandling = SelectCollectionHandling.LeaveAsIs)
 => ToList(path, propertyName, selectCollectionHandling);