Zetbox.Client.Presentables.ZetboxBase.InstanceListViewModel.EnsureOrderByExpression C# (CSharp) Method

EnsureOrderByExpression() private method

private EnsureOrderByExpression ( ) : void
return void
        private void EnsureOrderByExpression()
        {
            if (__orderByExpressionInitialized) return;
            __orderByExpressionInitialized = true;

            if (_initialOrderByExpression != null)
            {
                __orderByExpression = _initialOrderByExpression;
                __sortDirection = _initialSortDirection;
            }
            else if (UseNaturalSortOrder)
            {
                __orderByExpression = null;
                __sortDirection = System.ComponentModel.ListSortDirection.Ascending;
            }
            else
            {
                var sortProp = _type.AndParents(c => c.BaseObjectClass).SelectMany(c => c.Properties).Where(p => p.DefaultSortPriority != null).OrderBy(p => p.DefaultSortPriority).FirstOrDefault();
                if (sortProp != null)
                {
                    __orderByExpression = ColumnDisplayModel.FormatDynamicOrderByExpression(sortProp);
                    __sortDirection = System.ComponentModel.ListSortDirection.Ascending;
                }
                else
                {
                    __orderByExpression = null;
                    __sortDirection = System.ComponentModel.ListSortDirection.Ascending;
                }
            }
        }