[This is preliminary documentation and is subject to change.]

Encapsulates a custom filter.

Namespace:  Firefly.Box.Data.Advanced
Assembly:  Firefly.Box (in Firefly.Box.dll) Version: 3.4.23.6473 (3.4.23.6473)

Syntax

C#
public interface ICustomFilterMember
Visual Basic (Declaration)
Public Interface ICustomFilterMember
Visual C++
public interface class ICustomFilterMember

Remarks

Used in advanced custom filter situation, in which there is a need for a custom filter and a will to encapsulate it to prevent misuse.

Examples

CustomMemberFilter
This example is in the form of Unit Tests. It references the NUnit framework. This framework can be downloaded from www.NUnit.org. For more information about unit testing visit: www.NUnit.org.
This example is based on test data. The code for the entities included in this test data can be found in the documentation of Entity
CopyC#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Firefly.Box.Data;
using Firefly.Box.Data.Advanced;
using NUnit.Framework;
using Firefly.Box;
using Firefly.Box.Testing;

namespace TestFirefly.Box.Documentation
{
    [TestFixture]
    public class CustomFilterMemberDemo
    {
        [Test]
        public void UsageOfCustomMemberDemo()
        {
            var employees = new Pubs.Employees();
            employees.InitializeWithTestData();
            var bp = new BusinessProcess
            {
                From = employees
            };
            bp.Where.Add("{0}", new DBIn(employees.JobId,1,3,5,7));//See the DBIn class below
            bp.Run();
            bp.Counter.ShouldBe(12);
        }

        class DBIn : ICustomFilterMember
        {
            NumberColumn _column;
            Number[] _values;

            public DBIn(NumberColumn column, params Number[] values)
            {
                _values = values;
                _column = column;
            }

            public void SendFilterTo(CustomFilterCollector sendFilterString)
            {
                var args = new ArrayList();
                var inFunctionArguments = "";
                args.Add(_column);
                // Create the inside of the in method syntax according to the number of parameters received in the values.
                //For a dynamic number of parameters - for Example for three parameters it should look like "{1}, {2}, {3}
                foreach (var value in _values)
                {
                    if (inFunctionArguments.Length != 0)
                        inFunctionArguments += ", ";
                    inFunctionArguments += "{" + args.Count + "}";
                    args.Add(value);
                }
                sendFilterString("{0} in (" + inFunctionArguments + ")", args.ToArray());
            }
        }
    }
}

See Also