The article targets BCF-version 3.2. For 4.1 see: Quickstart


CalculationWorks BCF was designed to increase productivity when developing smart applications, smart clients and smart apps. BCF object models provides support for the “Big Calculation Five” challenges:

When developing BCF I always focused on:

  • Extensibility
  • Performance
  • Testability

This document is for .NET developers beginning with CalculationWorks BCF and will show how to use the main features and how to start developing a BCF Model.



Download and install "CalculationWorks BCF Free Edition" Editor.

Start Visual Studio and create a C# "Console Application" Project and select ".NET Framework 4.5" as target framework.

Install BCF Free Edition from NuGet.



Create a BCF Editor Project

Start BCF Editor Free Edition and click in "File" menu the "New..." button. BCF Editor will ask you for the new projects file name. Since BCF Editor prefers to use relative paths for dependencies and code geration (we will talk about later) it is recommended to save BCF Editor Project file in the c# project folder. In this sample I use "SampleModel" as file name.

The choosen file name will be set as default name prefix of all generated code files. You can change the class and file names later. So there is no reason to recreate a BCF Editor project e.g. because of upper cased file name.



Generating Classes

There are 5 code files the editor can generate.

DataSetSetup: contains schema definition and behavior items. DataSetSetup is the constructor parameter for DataSet

DataSet: Represents your object model.

Poco: stupid plain data classes. Useful when serializing/deserializing.

Forms & WPF ViewManager: Provides data binding support.

For this sample check "Generate DataSetSetup" and "Generate Typed DataSet". Set "BcfSampleConsole" as namespace for both files. Now set some more handy class and file names. I change "SampleModelDataSetSetup" to "SampleModelSetup" and "SampleModelDataSet" to "SampleModel".

Now in "Generator" menu click "Generate All". Now include the generated files in the c# project as shown.



Add Tables & Columns

Now back to BCF editor. Switch to "Tables" tab and add two tables:

  • table name: "Causeway"

    • column name: "Width" type "decimal"
    • column name: "Size" type "decimal?"

  • table name: "Segment"

    • column name: "Length" type "decimal"
    • column name: "Size" type "decimal"

BCF editor recognizes 3 conflicts 'value type does not allow null'. Well that's true. Default setting for allow null is true. So uncheck "AllowNull" on all columns but not on [Causeway].[Size] - the type is nullable.

TIP: double click error message to navigate to conflicting setting



Add Relations

Switch to "Relations" tab and add a relation "CausewaySegments". Select "Causeway" as parent and "Segment" as child table. Set "Delete Rule" to "Cascade".

Update rule doesn't matter because we do not define key columns in this sample.

The suggested method names are ok, but change "ParentRowProperty" to "CausewayRow".



Add Functions

The 2 columns should be computed:

Segment.Size = Segment.Length * Causeway.Width

Causeway.Size = Sum(Segment.Size[])

First we build the two functions. So back to Visual Studio and add a new class:

public class MultiplyFunction : BcfFunctionBase<decimal> {


public decimal Value1 { get; set; }


public decimal Value2 { get; set; }

public override decimal Compute() {

return Value1 * Value2;



and the second:

public class SumFunction : BcfFunctionBase<decimal?> {


public decimal[] Values { get; set; }

public override decimal? Compute() {

if (Values == null || Values.Length == 0) return null;

return Values.Sum();



TIP: Use the BCF codesnippeds.

Now compile the c# project and return to BCF editor.

Switch to "References" tab and click "Add Reference" tool (first tool in upper table). In file dialog select the c# project file (BcfSampleConsole.csproj). Now BCF editor loads the type information of projects output and of all its dependencies. So editor now knows MultiplyFunction and SumFunction. When changing functions you have to recompile the c# project and reload references in BCF editor.

Add a namespace import "BcfSampleConsole" on the same tab. So we can later use function class name without namespace.

Remark: References are loaded into the reflection only context so no code will be executed inside the BCF editor. 

Remark: Placing functions and DataSetSetup into the same project like in this sample is a circular dependency. You cannot generate code without the compiled project and you cannot compile when generated code became invalid. This is not a big deal. In more complex szenarios you should place the functions in another project. In simple szenarios like this you can delete the generated InitSetup method and its call to reenable compilation.

Now back to column [Segment].[Size]. Select or type "MultiplyFunction" into the "Function" field. Switch to "Parameters" tab and add parameter "Value1". In "AccessPath" field enter "Length". Add the second parameter "Value2". Use the access path browser tool by clicking the "Link" button and set "-CausewaySegment.Width" as shown.

Set SumFunction on column [Causeway].[Size] and wireup "Values" parameter with "+CausewaySegment.Size".

Remark: Prefixes "+" and "-" indicate the direction a relation is passed for parameter access. 



Enable Undo/Redo & Diagnostics

Undo/Redo and Diagnostics are implemented as dataset behavior items.

Here is a code sample how to use it:

var modelSetup = new SampleModelSetup();

modelSetup.BehaviorItems.Add(new BcfDataSetDiagnostics() { Enabled = true });

modelSetup.BehaviorItems.Add(new BcfDataSetUndoRepository());

I added some code to main(). It produces the output shown.

Download complete sample here.