Skip to content

BaseBatch Class

ivano scifoni edited this page Jan 25, 2018 · 3 revisions

To help developer, SharpBatch defines base class for a batch. The base class is named BaseBatch and defines some usefull property and method to develop batch.

Propery

Propery name Description
BatchContext ContextInvoker type who contains batch execution helper properties
Request HttpRequest type of request
Response HttpResponse type of response
Parameters Dictionary that contains batch parameters from url query string
SessionId SessionId of Batch execution
ParentSessionId SessionId of parent batch execution. This parameter has a value if the batch is started from another batch
Configuration Dictionary that contains Batch configuration

Methods

There are some methods to manage result to file or to tracking destination.

ToTracking methods

Parameters Description
ToTracking(string content) Save into Messages field of TrackingModel the content string
ToTracking(object data) Save into Messages field the serialization of data. It uses serialization configured into startup class.
ToTracking(object data, IModelSerializer serializer) Save into Messages field the serialization of data. It specifies serialization identified by serializer parameter

ToFile methods

Parameters Description
ToFile(object content, string fileName) saves the content into a file named fileName
ToFile(object content, string fileName, string fileExtention) Saves the content into a file named fileName with extention fileExtention
ToFile(object content, string fileName, string fileExtention, string path) Saves the content into a file named fileName with extention fileExtention into the specified path

Clone this wiki locally