Xafari Server. Application Requirements

The application that uses the Xafari Server must satisfy certain requirements described in this section.

ObjectSpaceProvider

The application must use the SecuredObjectSpaceProvider (see https://documentation.devexpress.com/#eXpressAppFramework/CustomDocument113437). For this, override the XafApplication.CreateDefaultObjectSpaceProvider method in the application class (XafApplication heir). The code snippet below demonstrates how to do this:

using DevExpress.ExpressApp.Security;

using DevExpress.ExpressApp.Security.ClientServer;

// ... 

protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args) 

{

  args.ObjectSpaceProvider = new SecuredObjectSpaceProvider((SecurityStrategyComplex)Security, args.ConnectionString, args.Connection);

}

You can also implement a XafApplication.CreateCustomObjectSpaceProvide event handler and use it in AppModule. This is done in the attached example, and it is the preferred approach when developing with Xafari.

public override void Setup(XafApplication application) {

  base.Setup(application);

  // ...

  Application.CreateCustomObjectSpaceProvider += Application_CreateCustomObjectSpaceProvider;

  // ...

}

private void Application_CreateCustomObjectSpaceProvider(

        object sender, CreateCustomObjectSpaceProviderEventArgs e)

    {

        if (e.ObjectSpaceProvider == null)

        {

            var app = (XafApplication) sender;

            var security = (SecurityStrategy) app.Security;

            e.ObjectSpaceProvider = new SecuredObjectSpaceProvider(

                security, e.ConnectionString, e.Connection);

        }

    }


Security Strategy

Using SecuredObjectSpaceProvider in the application, in turn, requires the Security System to use a DevExpress.ExpressApp.Security.SecurityStrategyComplex class (see https://documentation.devexpress.com/#eXpressAppFramework/clsDevExpressExpressAppSecuritySecurityStrategyComplextopic).

Value manager

If the Xafari Server is running in dedicated server  mode, the server part of the application must use Xafari.XafariMultiThreadValueManager<T> as ValueManager. To do this, set the ValueManager.ValueManagerType static property:

ValueManager.ValueManagerType = typeof(XafariMultiThreadValueManager<>).GetGenericTypeDefinition();

This must be done before any treatment to ValueManager. For example, in the constructor of the application class.

There is StartXafariServer console command, it provides start the server using the RunCmd.exe utility. In such a scenario of running, set the type of using ValueManager in appSettins section of the application config-file.

<add key="ValueManagerType" value="Xafari.XafariMultiThreadValueManager'1" />

RunCmd.exe reads the value of this key and sets the value of ValueManager.ValueManagerType static property.

During operation the client side of the application, it is possible to use any ValueManager needed by the app developer.