BusinessProcessAdvancedSettingsSuppressValueBindingInInsertActivity Property

Gets or sets the value determining if initial value binding is suppressed when the BusinessProcessActivity property is set to Insert.

Definition

Namespace: Firefly.Box
Assembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
C#
public bool SuppressValueBindingInInsertActivity { get; set; }

Property Value

Boolean

Remarks

This property doesn't affect reevaluation

Example

SupressValueBinding
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
C#
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Firefly.Box;
using Firefly.Box.Testing;

namespace TestFirefly.Box.Documentation
{
    [TestFixture]
    public class SupressValueBindingDemo
    {
        [Test]
        public void Supressed()
        {
            var jobs = new Pubs.Jobs();
            jobs.Truncate();

            var bp =
                new BusinessProcess(
                    new BusinessProcess.AdvancedSettings
                        {
                            SuppressValueBindingInInsertActivity = true
                        })
                    {
                        From = jobs,
                        Activity = Activities.Insert
                    };
            bp.AddAllColumns();

            jobs.Id.BindValue(() => 1);
            bp.ForFirstRow(() => jobs.Id.ShouldBe(0));//Because the bind value is supressed, the id is 0
        }
        [Test]
        public void NotSupressed()
        {
            var jobs = new Pubs.Jobs();
            jobs.Truncate();

            var bp =
                new BusinessProcess(
                    new BusinessProcess.AdvancedSettings
                    {
                        SuppressValueBindingInInsertActivity = false
                    })
                {
                    From = jobs,
                    Activity = Activities.Insert
                };
            bp.AddAllColumns();

            jobs.Id.BindValue(() => 1);
            bp.ForFirstRow(() => jobs.Id.ShouldBe(1));//Because the bind value is not supressed, 
                    // it is evaluated, and the value is 1;
        }
    }
}

See Also