Business Object Proxies
Running server-side business logic with support for customizations
As of version 16 the old BusinessFunctions are no longer usable. The recommended way of running server-side business logic is via the Business Object Proxies.
Starting with version 16 we added the possibility to run business object methods on the server-side, similar to what the old BusinessFunctions
could do, with the addition of being able to run customized code as well, with each customization being specific to each server mandant.
Invoking business logic on the server is straightforward, by using the newly added TimeLine.Framework.Business.BusinessObjectProxy<T>
type. You can also use the non-generic version TimeLine.Framework.Business.BusinessObjectProxy
type.
Here's an example of a simple business object that returns a simple hello world message:
You can easily invoke the SayHello
method on the server by creating a Proxy
instance, as follows:
Using the non-generic BusinessObjectProxy.Get(businessObjectId) method will allow you to invoke methods dynamically, like so:
Dynamic invocation might be preferred when the caller does not know the called type.
The above code creates a busHelloWorld
instance on the server and invoke the method with the parameters that were passed in from the client, before returning the result back to the client.
Serialization is done automatically and supports all basic .NET Framework types (+ADO.NET) as well as xDataSet
. You can also implement custom Newtonsoft.Json
serializers for your custom data types.
Both the dynamic and strongly typed invocation APIs have async variants and all APIs support passing in an optional xTransaction
object that will be used when initializing the business object on the server-side. This way you can call multiple methods using the same transaction between these calls.
Business object methods that are to be called via the proxy should be designed with immutability in mind - each method call should receive all data it requires through it's parameters. State is not kept between proxy calls on the business object created on the server between methods.
Keep in mind that calling a method on a customized business object will require that both the client and the server point to the same customization (the customization will need to be deployed and updated on the server machine as well).
Last updated