Table of Contents

Interface IBpApplication

Namespace
BpNexT.NET
Assembly
BpNexT.NET.Contracts.Com.dll

Contract for the BpNexT.NET wrapper around a microtech ERP COM application instance. Allows consumers (e.g. plugins) to code against the API surface without referencing the implementation assembly.

public interface IBpApplication : IDisposable
Inherited Members

Properties

Dokumente

Accesses the Dokumente special object.

BpSpecialObject<AutoDokument> Dokumente { get; }

Property Value

BpSpecialObject<AutoDokument>

Remarks

Drucken

Accesses the Drucken special object.

BpSpecialObject<AutoSpecialDrucken> Drucken { get; }

Property Value

BpSpecialObject<AutoSpecialDrucken>

Remarks

Events

Accesses the Events special object.

BpSpecialObject<AutoSpecialEvents> Events { get; }

Property Value

BpSpecialObject<AutoSpecialEvents>

Remarks

InstanceId

Unique identifier for this microtech ERP application instance.

Guid InstanceId { get; }

Property Value

Guid

Lager

Accesses the Lager special object.

BpSpecialObject<AutoLager> Lager { get; }

Property Value

BpSpecialObject<AutoLager>

Remarks

Projekte

Accesses the Projekte special object.

BpSpecialObject<AutoSpecialProjekte> Projekte { get; }

Property Value

BpSpecialObject<AutoSpecialProjekte>

Remarks

RequestRetryCount

Gets or sets the retry count for requests to the microtech ERP application.

int RequestRetryCount { get; set; }

Property Value

int

RequestTimeOut

Gets or sets the timeout (in milliseconds) for requests to the microtech ERP application.

int RequestTimeOut { get; set; }

Property Value

int

Vorgaenge

Accesses the Vorgang special object.

BpSpecialObject<AutoVorgang> Vorgaenge { get; }

Property Value

BpSpecialObject<AutoVorgang>

Remarks

Wandeln

Accesses the Wandeln special object for converting Vorgänge.

BpSpecialObject<AutoWandeln> Wandeln { get; }

Property Value

BpSpecialObject<AutoWandeln>

Remarks

Methods

AddDataSet<T>()

Appends a new instance to the AutoDataSet of type T.

T AddDataSet<T>() where T : IHasAutoDataSet, new()

Returns

T

An instance of type T with properties populated from the AutoDataSet.

Type Parameters

T

The type of the object to append, which must inherit from HasAutoDataSet and have a parameterless constructor.

AllocSpecialObject<T>(SpecialObjects)

Allocates an instance of a special object, wrapped with its owning BpApplication instance ID.

BpSpecialObject<T> AllocSpecialObject<T>(SpecialObjects specialObjectEnum) where T : class

Parameters

specialObjectEnum SpecialObjects

The identifier of the special object.

Returns

BpSpecialObject<T>

A BpSpecialObject<T> containing the special object of type T.

Type Parameters

T

The type of the special object.

Remarks

ArtikelLager(string, string?)

Initializes a LagerContext for a specific article and currency.

ILagerContext ArtikelLager(string artikelNummer, string? waehrung = null)

Parameters

artikelNummer string
waehrung string

Returns

ILagerContext

ClearSolutionPartnerCredentials()

Clears previously set solution partner credentials so that subsequent logins fall back to the auto-detected company name.

void ClearSolutionPartnerCredentials()

DeselectMandant()

Deselects the currently selected mandant.

void DeselectMandant()

EnsureTransactionSafety(string)

Validates if the current thread is allowed to write to the given DataSet.

void EnsureTransactionSafety(string dataSetName)

Parameters

dataSetName string

The logical name of the dataset (e.g. "Artikel")

FindById<T>(int)

Retrieves the dataset of the specified type by the given ID.

T? FindById<T>(int id) where T : IHasAutoDataSet, new()

Parameters

id int

The ID to search for.

Returns

T

The dataset of the specified type if found; otherwise, null.

Type Parameters

T

Find<T>(IDataSetIndex, string[]?)

Retrieves the dataset of the specified type by the given index.

T? Find<T>(IDataSetIndex index, string[]? includes = null) where T : IHasAutoDataSet, new()

Parameters

index IDataSetIndex

An instance of IDataSetIndex to use for the search.

includes string[]

Optional: Names of the fields to load in the dataset.

Returns

T

The dataset of the specified type if found; otherwise, null.

Type Parameters

T

FreeSpecialObject<T>(BpSpecialObject<T>)

Frees a special object and removes it from the cache. Expects a BpSpecialObject<T> or the raw COM object if cached directly.

void FreeSpecialObject<T>(BpSpecialObject<T> wrapper) where T : class

Parameters

wrapper BpSpecialObject<T>

The special object wrapper to be freed.

Type Parameters

T

The type of the raw special object.

Get()

Gets the microtech ERP application instance. With this instance, you can access all microtech ERP functions according to the microtech ERP documentation.

Application Get()

Returns

Application

GetChanged<T>(DateTime, string?, string[]?)

Retrieves a dataset of the specified type that has changed since the given date, with an optional filter.

IFilterableDataSet<T> GetChanged<T>(DateTime date, string? filter = null, string[]? includes = null) where T : IHasAutoDataSet, IHasAendDat, new()

Parameters

date DateTime

The date to filter changes from.

filter string

Optional: Filter to apply to the dataset.

includes string[]

Optional: Names of the fields to load in the dataset.

Returns

IFilterableDataSet<T>

An enumerable collection of the specified type.

Type Parameters

T

The type of the dataset.

GetChanged<T>(Func<string, string, DateTime>, string?, string[]?)

Retrieves a dataset of the specified type that has changed since the given date, with an optional filter.

IFilterableDataSet<T> GetChanged<T>(Func<string, string, DateTime> getLastSyncDate, string? filter = null, string[]? includes = null) where T : IHasAutoDataSet, IHasAendDat, new()

Parameters

getLastSyncDate Func<string, string, DateTime>

A function to get the last sync date for the item.

filter string

Optional filter to apply to the dataset.

includes string[]

Optional: Names of the fields to load in the dataset.

Returns

IFilterableDataSet<T>

An enumerable collection of the specified type.

Type Parameters

T

The type of the dataset.

GetCustomerData()

Retrieves customer data.

BpCustomerData GetCustomerData()

Returns

BpCustomerData

A BpCustomerData object containing customer information.

GetDataSet(string, string?)

Retrieves a dataset of the specified type with an optional filter.

IEnumerable<IHasAutoDataSet> GetDataSet(string dataSetName, string? filter = null)

Parameters

dataSetName string

The name of the dataset to retrieve.

filter string

Optional filter to apply to the dataset.

Returns

IEnumerable<IHasAutoDataSet>

An enumerable collection of the specified type.

GetDataSet<T>(string?, string[]?)

Retrieves a dataset of the specified type with an optional filter.

IFilterableDataSet<T> GetDataSet<T>(string? filter = null, string[]? includes = null) where T : IHasAutoDataSet, new()

Parameters

filter string

Optional: Filter to apply to the dataset.

includes string[]

Optional: Names of the fields to load in the dataset.

Returns

IFilterableDataSet<T>

An enumerable collection of the specified type.

Type Parameters

T

The type of the dataset.

GetLoginException()

Retrieves and clears the last exception that occurred during microtech ERP login.

Exception? GetLoginException()

Returns

Exception

The last login exception, or null if no exception occurred.

GetMandant()

Returns the currently specified mandant.

string? GetMandant()

Returns

string

GetMandantState()

Gets the current mandant state from microtech ERP. Returns Unavailable instead of throwing when the COM server process is unreachable; recover via RecreateApplication(bool) and a fresh login.

MandantState GetMandantState()

Returns

MandantState

The current MandantState.

GetRange<T>(IDataSetIndex, IDataSetIndex, string?, string[]?)

Retrieves a dataset of the specified type within a given range.

IFilterableDataSet<T> GetRange<T>(IDataSetIndex indexStart, IDataSetIndex indexEnd, string? filter = null, string[]? includes = null) where T : IHasAutoDataSet, new()

Parameters

indexStart IDataSetIndex

The limits for the range start.

indexEnd IDataSetIndex

The limits for the range end.

filter string

Optional: Filter to apply to the dataset.

includes string[]

Optional: Names of the fields to load in the dataset.

Returns

IFilterableDataSet<T>

An enumerable collection of the specified type.

Type Parameters

T

The type of the dataset.

GetSelektionsFelder(string)

Retrieves the SelektionsFelder for the specified DataSet name. Results are cached per DataSet name.

List<SelektionsFeld> GetSelektionsFelder(string dataSetName)

Parameters

dataSetName string

The name of the DataSet.

Returns

List<SelektionsFeld>

A list of SelektionsFelder for the DataSet.

GetSelektionsFelder<T>()

Retrieves the SelektionsFelder for the specified DataSet type. Results are cached per DataSet name.

List<SelektionsFeld> GetSelektionsFelder<T>() where T : IHasAutoDataSet

Returns

List<SelektionsFeld>

A list of SelektionsFelder for the type.

Type Parameters

T

The DataSet type.

InsertDataSet<T>()

Inserts a new instance into the AutoDataSet of type T.

[Obsolete("Use AddDataSet<T>() instead.")]
T InsertDataSet<T>() where T : IHasAutoDataSet, new()

Returns

T

An instance of type T with properties populated from the AutoDataSet.

Type Parameters

T

The type of the object to insert, which must inherit from HasAutoDataSet and have a parameterless constructor.

IsLoggedIn()

Returns whether the user is logged in.

bool IsLoggedIn()

Returns

bool

LoggedInAs()

Returns the currently logged-in mandant or an empty string if no mandant is selected.

string LoggedInAs()

Returns

string

Login(string, string, string?)

Logs in to the application using the provided username and password. Uses the solution partner credentials set via SetSolutionPartnerCredentials(string, string) if present, otherwise automatically gathers the company name.

bool Login(string username, string password, string? mandant = null)

Parameters

username string

The username for login.

password string

The password for login.

mandant string

Optional mandant to select after login.

Returns

bool

True if login is successful, otherwise false.

Login(string, string, string, string, string?)

Logs in to the application using the provided connection details.

bool Login(string connectionName, string connectionKey, string username, string password, string? mandant = null)

Parameters

connectionName string

The connection name.

connectionKey string

The connection key.

username string

The username for login.

password string

The password for login.

mandant string

Optional mandant to select after login.

Returns

bool

True if login is successful, otherwise false.

Remarks

If the function returns false, use GetLoginException() to retrieve the last exception that occurred during login.

Logout()

Logs out of the application.

void Logout()

OpenDataSet(string)

Opens a dataset of the specified type.

AutoDataSet OpenDataSet(string dataSet)

Parameters

dataSet string

Returns

AutoDataSet

OpenDataSet<T>()

Opens a dataset of the specified type.

AutoDataSet OpenDataSet<T>()

Returns

AutoDataSet

Type Parameters

T

QueryChanged<T>(DateTime, string[]?)

Retrieves a dataset of the specified type that has changed since the given date.

IQueryable<T> QueryChanged<T>(DateTime date, string[]? includes = null) where T : class, IHasAutoDataSet, IHasAendDat, new()

Parameters

date DateTime

The date to filter changes from.

includes string[]

Optional: Names of the fields to load in the dataset.

Returns

IQueryable<T>

Type Parameters

T

QueryChanged<T>(Func<string, string, DateTime>, string[]?)

Retrieves a dataset of the specified type that has changed since the last sync date.

IQueryable<T> QueryChanged<T>(Func<string, string, DateTime> getLastSyncDate, string[]? includes = null) where T : IHasAutoDataSet, IHasAendDat, new()

Parameters

getLastSyncDate Func<string, string, DateTime>

A function to get the last sync date for the item.

includes string[]

Optional: Names of the fields to load in the dataset.

Returns

IQueryable<T>

Type Parameters

T

The type of the dataset.

QueryDataSet<T>(string[]?)

Returns an IQueryable for the specified DataSet type, automatically optimizing queries using available indices where possible.

IQueryable<T> QueryDataSet<T>(string[]? includes = null) where T : IHasAutoDataSet, new()

Parameters

includes string[]

Returns

IQueryable<T>

Type Parameters

T

The DataSet type.

ReadChanged<T>(DateTime, string[]?, int)

Retrieves a dataset of the specified type that has changed since the given date.

IQueryable<T> ReadChanged<T>(DateTime date, string[]? includes = null, int chunkSize = 1000) where T : class, IHasAutoDataSet, IHasAendDat, new()

Parameters

date DateTime

The date to filter changes from.

includes string[]

Optional: Names of the fields to load in the dataset.

chunkSize int

Optional: The size of the chunks to read from the dataset.

Returns

IQueryable<T>

Type Parameters

T

ReadChanged<T>(Func<string, string, DateTime>, string[]?, int)

Retrieves a dataset of the specified type that has changed since the last sync date.

IQueryable<T> ReadChanged<T>(Func<string, string, DateTime> getLastSyncDate, string[]? includes = null, int chunkSize = 1000) where T : IHasAutoDataSet, IHasAendDat, new()

Parameters

getLastSyncDate Func<string, string, DateTime>

A function to get the last sync date for the item.

includes string[]

Optional: Names of the fields to load in the dataset.

chunkSize int

Optional: The size of the chunks to read from the dataset.

Returns

IQueryable<T>

Type Parameters

T

The type of the dataset.

ReadDataSet<T>(string[]?, int)

Returns an IQueryable for the specified DataSet type, automatically optimizing queries using available indices where possible. Returned objects are read-only and will not be tracked.

IQueryable<T> ReadDataSet<T>(string[]? includes = null, int chunkSize = 1000) where T : IHasAutoDataSet, new()

Parameters

includes string[]
chunkSize int

Returns

IQueryable<T>

Type Parameters

T

RecreateApplication(bool)

Recreates the microtech ERP application instance. Use this method to reset the application state if the RPC server becomes unresponsive.

void RecreateApplication(bool killProcess = false)

Parameters

killProcess bool

If true, the previous/existing microtech ERP process will be terminated before recreating the application instance.

RequiresReLogin()

Returns whether the current session requires a re-login due to a day change, a parameter change, or an unreachable COM server (Unavailable — recreate the application first).

bool RequiresReLogin()

Returns

bool

True if a re-login is required, otherwise false.

SelectMandant(string)

Selects the specified mandant.

void SelectMandant(string mandant)

Parameters

mandant string

The mandant to select.

SetRetryTimeout(int, int)

Sets the retry count and timeout for requests to the microtech ERP application.

void SetRetryTimeout(int retryCount = 100, int timeout = 2000)

Parameters

retryCount int
timeout int

SetSolutionPartnerCredentials(string, string)

Sets the solution partner credentials to use for subsequent logins. Must be called before Login(string, string, string?); when set, login connects via the solution partner name and key instead of the auto-detected company name.

void SetSolutionPartnerCredentials(string name, string key)

Parameters

name string

The solution partner name.

key string

The solution partner key.

StartTransaction(string)

Starts a transaction for the specified DataSet name.

IBpTransaction StartTransaction(string dataSetName)

Parameters

dataSetName string

Returns

IBpTransaction

StartTransaction<T>()

Starts a transaction for the specified DataSet type.

IBpTransaction StartTransaction<T>() where T : IHasAutoDataSet

Returns

IBpTransaction

Type Parameters

T

SubscribeToNotifications(Func<MeldFensterRequest, int>, Action<Exception>?)

Subscribes to microtech ERP notifications.

IDisposable SubscribeToNotifications(Func<MeldFensterRequest, int> handler, Action<Exception>? onError = null)

Parameters

handler Func<MeldFensterRequest, int>
onError Action<Exception>

Returns

IDisposable

A disposable that detaches the subscription on dispose.

WandelnVorgang(string, int)

Creates a WandelnBuilder to convert a Vorgang to a different Vorgangsart.

IWandelnBuilder WandelnVorgang(string vorgangNr, int targetVorgangArt)

Parameters

vorgangNr string

The Vorgangsnummer (BelegNr) of the Vorgang to convert.

targetVorgangArt int

The target Vorgangsart number (from BEARBEITEN - PARAMETER - ARTEN).

Returns

IWandelnBuilder

An IWandelnBuilder for fluent configuration.