FluentAPI Reference

The FluentAPI is divided into three main sections: the ModuleBuilder, the ModuleInputBuilder, and the ApplicationInspector. At a high level, the ModuleBuilder is used to orchestrate ModuleInputs and ModuleOutputs, the ModuleInputBuilder is used to set those inputs and outputs, and the ApplicationInspector is used to run an app as well as view the outputs of an app that has been run. Please refer to the documentation below for more information.

ModuleBuilder

  • Create<T>
    • Creates a new ModuleBuilder of module type T
    • Input Parameters:
      • None
    • Returns:
      • ModuleBuilder<T>
    • ex: var calculatorModuleBuilder = ModuleBuilder.Create<CalculatorModuleExecutor>();
  • ConfigureInput<U>
    • Selects one of the Module's inputs via a lambda function
    • Input Parameters:
      • Expression<Func<TModule, ModuleInput<TInput>>> propertySelector: this parameter is simply a lambda function that takes an instance of the ModuleExecutor type passed to the Create<T> method and returns the module input you'd like to select
    • Returns:
      • A ModuleInputBuilder\<T>
    • ex: calculatorModuleBuilder.ConfigureInput(module => module.Param1).WithValue(5);
  • SelectOutput<T>
    • Selects a ModuleOutput of the ModuleExecutor type <T>
    • Input Parameters:
      • Expression<Func<TModule, ModuleOutput<TOutput>>> propertySelector: this parameter is a lambda function that takes an instance of the ModuleExecutor type passed to the Create<T> method and returns the module output you'd like to select
      • Returns:
        • A ModuleOutput<U>
      • ex: var moduleOutput = calculatorModuleBuilder.SelectOutput(module => module.Result);
  • SelectOutputValue<T>
    • Selects a the value stored in the ModuleOutput of the ModuleExecutor type <T>
    • Input Parameters:
      • Expression<Func<TModule, ModuleOutput<TOutput>>> propertySelector: this parameter is a lambda function that takes an instance of the ModuleExecutor type passed to the Create<T> method and returns the value stored in the module output you'd like to select
    • Returns:
      • A <T> (depending on the type of the ModuleOutput you're selecting)
    • ex: var value = calculatorModuleBuilder.SelectOutputValue<double>(module => module.Result);
  • SetRequestingExecutionTo
    • Sets whether or not the module will be executed upon the running of the application (it is true by default)
    • Input parameters:
      • bool requestingExecution: whether or not this module should execute upon running the application
    • Returns:
      • The same ModuleBuilder<T> upon which this method was called
    • ex: calculatorModuleBuilder.SetRequestingExecutionTo(false);
  • AddToApp
    • Adds the Module stored in this ModuleBuilder to the passed Application
    • Input Parameters:
      • Application app: The Application to which this Module will be added
    • Returns:
      • The same ModuleBuilder<T> upon which this method was called
    • ex: calculatorModuleBuilder.AddToApp(application);

ModuleInputBuilder

  • WithValue<TInput>
    • Sets the value of a ModuleInput
    • Input Parameters:
      • TInput value: the value to which the selected ModuleInput should be set
    • Returns:
      • The same ModuleInputBuilder upon which this method was called
    • ex: var calculator = ModuleBuilder.Create<CalculatorModuleExecutor>().ConfigureInput(m => m.Param1).WithValue(3.2); sets the first parameter in a calculator module with the value 3.2
  • WithConnection
    • Connects this ModuleInput to the output of another module
    • Input Parameters:
      • ModuleOutput moduleOutput: The ModuleOutput to which this ModuleInput will be connected
    • Returns:
      • The same ModuleInputBuilder upon which this method was called
    • ex: calculator2.ConfigureInput(m => m.Param1).WithConnection(calculator1.SelectOutput(upstream => upstream.Result)); connects the output of calculator1 to the first parameter in the second calculator
  • The ModuleInputBuilder also has convinience methods that work the same as the ModuleBuilder that simply operate on the Module to which this ModuleInput belongs;
    • ConfigureInput
    • SelectOutput
    • SelectOutputValue
    • SetRequestingExecutionTo
    • AddToApp

ApplicationInspector

  • Create
    • Creates a new ApplicationInspector
    • Input Parameters:
      • Application app: (optional) the Application that will be stored in this ApplicationInspector. If not supplied, a new Application is instantiated.
      • bool windowsAuth: (optional) whether we should use Windows Authentication or Forms Auth (username/password). If not supplied, we default to Forms Auth.
    • Returns:
      • A new ApplicationInspector
    • ex: var appInspector = ApplicationInspector.Create(app, true);
  • GetModuleBuilder<TModule>
    • Extracts a ModuleBuilder<TModule> object using the Application stored in this ApplicationInspector
    • There are three variants of this function, all with different Input Parameters:
      • None: returns the first instance of a Module of type TModule that is found in the Module collection on the Application
      • int index: returns a ModuleBuilder<TModule> for the Module at the passed index in the Module collection on the Application. Note that this will throw an InvalidCastException if the TModule is not assignable from the module executor type at the index.
      • string name: returns a ModuleBuilder with a reference to the first Module in this ApplicationInspector's Application with the specified name
    • Returns:
      • A ModuleBuilder<TInput> that is appropriate given the supplied parameters
    • ex: appInspector.GetModuleBuilder<CalculatorModuleExecutor>() returns a ModuleBuilder<CalculatorModuleExecutor> for the first instance of a CalculatorModuleExecutor that we find in the Application's modules
    • ex: appInspector.GetModuleBuilder<CalculatorModuleExecutor>(1) returns the CalculatorModuleExecutor at index 1
  • SetBaseUri
    • Sets the BaseUri of the Composable web services
    • Input Parameters:
      • Uri baseUri: The base Uri of Composable
    • Returns:
      • The ApplicationInspector this method was called on
    • ex: var appInspector = ApplicationInspector.Create().SetBaseUri(new Uri("http://localhost/CompApp/));
  • SetUserName
    • Sets the Username for use with Forms Authentication
    • Input Parameters:
      • string userName: Your Username
    • Returns:
      • The ApplicationInspector this method was called on
    • ex: var appInspector = ApplicationInspector.Create().SetUserName("myusername");
  • SetPassword
    • Sets the Password for use with Forms Authentication
    • Input Parameters:
      • string password: Your Password
    • Returns:
      • The ApplicationInspector this method was called on
    • ex: var appInspector = ApplicationInspector.Create().SetPassword("mypassword");
  • Configure
    • Convinience method to set the BaseUri, UserName, and Password all at once
    • Input Parameters:
      • Uri baseUri: The base Uri of Composable
      • string userName: Your UserName
      • string password: Your Password
    • Returns:
      • The ApplicationInspector this method was called on
    • ex: var appInspector = ApplicationInspector.Create().Configure(new Uri("http://cloud.composableanalytics.com/"), "myusername", "mypassword");`
  • UseWindowsAuth
    • Tells the Application to run using Windows Authentication
    • Input Parameters:
      • None
    • Returns:
      • The ApplicationInspector this method was called on
    • ex: var appInspector = ApplicationInspector.Create().UseWindowsAuth();
  • UseFormsAuth
    • Tells the Application to run using Forms Authentication
    • Input Parameters:
      • None
    • Returns:
      • The ApplicationInspector this method was called on
    • ex: var appInspector = ApplicationInspector.Create().UseFormsAuth();
  • Run
    • Runs an Application using the settings that have been configured in the ApplicationInspector, storing the resulting Application in the ApplicationInspector's Application
    • Input Parameters:
      • None
    • Returns:
      • The ApplicationInspector this method was called on
    • ex: var appInspector = ApplicationInspector.Create().Configure(new Uri("http://cloud.composableanalytics.com/"), "myusername", "mypassword").Run();
  • RunAsync
    • Runs an Application using the settings that have been configured in the ApplicationInspector, storing the resulting Application in the ApplicationInspector's Application
    • Input Parameters:
      • None
    • Returns:
      • The ApplicationInspector this method was called on
    • ex: var appInspector = ApplicationInspector.Create().Configure(new Uri("http://cloud.composableanalytics.com/"), "myusername", "mypassword").RunAsync();
  • ImportAppFromJson
    • Imports an Application into this ApplicationInspector from the given Json string
    • Input Parameters:
      • string json: The Json representation of the Application you wish to import
    • Returns:
      • The ApplicationInspector this method was called on
    • ex: var appInspector = ApplicationInspector.Create().Configure(new Uri("http://cloud.composableanalytics.com/"), "myusername", "mypassword").ImportAppFromJson(myJsonString).Run();
  • ImportAppFromFile
    • Imports an Application into this ApplicationInspector from the given file path
    • Input Parameters:
      • string path: The Json file storing the representation of the Application you wish to import
    • Returns:
      • The ApplicationInspector this method was called on
    • ex: var appInspector = ApplicationInspector.Create().Configure(new Uri("http://cloud.composableanalytics.com/"), "myusername", "mypassword").ImportAppFromFile(@"C:\Path\to\Json\file.json").Run();