Example #1
0
    private void Join()
    {
        Bootstrapper.GetLocker().Lock(i =>
        {
            if (!_isJoined)
            {
                foreach (var specification in _specifications)
                {
                    if (specification.Criterion != null)
                    {
                        if (Criterion is null)
                        {
                            Criterion = specification.Criterion;
                        }
                        else
                        {
                            Criterion = Criterion.AndAlso(specification.Criterion);
                        }
                    }

                    if (specification.OrderBy != null)
                    {
                        if (OrderBy is null)
                        {
                            OrderBy = specification.OrderBy;
                        }
                        else
                        {
                            OrderBy = OrderBy.AndAlso(specification.OrderBy);
                        }
                    }

                    if (specification.OrderByDescending != null)
                    {
                        if (OrderByDescending is null)
                        {
                            OrderByDescending = specification.OrderByDescending;
                        }
                        else
                        {
                            OrderByDescending = OrderByDescending.AndAlso(specification.OrderByDescending);
                        }
                    }
                }

                _isJoined = true;
            }
        });
    }