• API
Show / Hide Table of Contents
  • BiExcellence.OpenBi.Api
    • IOpenBiConfiguration
    • IOpenBiRequest
    • IOpenBiRequestSerializable
    • IOpenBiResponse
    • IOpenBiServerMessage
    • IOpenBiSession
    • IOpenBiSessionHttpClient
    • MessageCategory
    • OpenBiConfiguration
    • OpenBiConfigurationExtensions
    • OpenBiErrorEventArgs
    • OpenBiRequestEventArgs
    • OpenBiRequestExtensions
    • OpenBiResponseCodes
    • OpenBiResponseEventArgs
    • OpenBiServerErrorException
    • OpenBiSession
    • OpenBiSessionExtensions
    • Protocol
    • SecureOpenBiSession
  • BiExcellence.OpenBi.Api.Commands
    • ContentTypes
    • Filter
    • FilterOperator
    • FilterSign
    • HierarchyNode<T>
    • IFilter
    • IListRequest
    • IListRequest<T>
    • IListResponse
    • IListResponse<T>
    • ILoginInfo
    • IPingInfo
    • ISessionInfo
    • ListRequestExtensions
    • OpenBiLoginExtensions
    • OpenBiPingExtensions
  • BiExcellence.OpenBi.Api.Commands.AuthObjects
    • AuthObject
    • AuthObjectValue
    • IAuthObject
    • IAuthObjectValue
    • OpenBiAuthObjectExtensions
  • BiExcellence.OpenBi.Api.Commands.AuthObjects.Internal
    • AuthObjectJsonImpl
    • AuthObjectValueJsonImpl
  • BiExcellence.OpenBi.Api.Commands.BatchJobs
    • BatchJob
    • BatchJobHandlerParameterType
    • BatchJobParameter
    • BatchJobPeriodicType
    • BatchJobType
    • IBatchJob
    • IBatchJobHandler
    • IBatchJobHandlerParameter
    • IBatchJobLog
    • IBatchJobLogEntry
    • IBatchJobParameter
    • OpenBiBatchJobExtensions
    • OpenBiConfigurationExtensions
  • BiExcellence.OpenBi.Api.Commands.BatchJobs.Internal
    • BatchJobJsonImpl
    • BatchJobParameterJsonImpl
  • BiExcellence.OpenBi.Api.Commands.Blogs
    • Blog
    • BlogArticle
    • IBlog
    • IBlogArticle
    • OpenBiBlogExtensions
  • BiExcellence.OpenBi.Api.Commands.Blogs.Internal
    • BlogArticleJsonImpl
    • BlogJsonImpl
  • BiExcellence.OpenBi.Api.Commands.Cms
    • CmsItemAttributeTypes
    • CmsItemTemplate
    • ICmsItem
    • ICmsItemAttribute
    • ICmsItemDefinition
    • ICmsItemReplacementParameter
    • ICmsItemTemplate
    • ICmsItemTemplateHistory
    • OpenBiCmsExtensions
  • BiExcellence.OpenBi.Api.Commands.Cms.Internal
    • CmsItemTemplateJsonImpl
  • BiExcellence.OpenBi.Api.Commands.Configurator
    • IObjectLock
    • IServerError
    • ITransportTask
    • ITransportTaskElement
    • OpenBiEmailExtensions
    • OpenBiObjectLockExtensions
    • OpenBiServerErrorExtensions
    • OpenBiTransportTaskExtensions
    • TransportTask
    • TransportTaskElement
    • TransportTaskElementActions
    • TransportTaskElementTypes
    • TransportTaskStates
  • BiExcellence.OpenBi.Api.Commands.ConnectionTemplates
    • ConnectionTemplate
    • ConnectionTemplateParameter
    • ConnectionTemplateParameterType
    • DataProviderTypes
    • IConnection
    • IConnectionTemplate
    • IConnectionTemplateParameter
    • IDataProviderType
    • OpenBiConnectionExtensions
    • OpenBiConnectionTemplateExtensions
    • OpenBiRequestExtensions
  • BiExcellence.OpenBi.Api.Commands.ConnectionTemplates.Internal
    • ConnectionTemplateJsonImpl
    • ConnectionTemplateParameterJsonImpl
  • BiExcellence.OpenBi.Api.Commands.DataProviders
    • AffectedDataProvider
    • AffectedDataProviderMode
    • AlertLevel
    • AlertLevelId
    • ChartDataExtensions
    • DataProvider
    • DataProviderCubeType
    • DataProviderDefinition
    • DataProviderExtensions
    • DataProviderRoleType
    • DataProviderView
    • DataProviderViewExtensions
    • DataVisualType
    • Dimension
    • DimensionAxis
    • DimensionSortType
    • DimensionSumState
    • DrillState
    • DrillStateTuple
    • DrillStateValue
    • F4ValueExtensions
    • GridCellContent
    • GridDefinitionEventArgs
    • GridExtensions
    • IAffectedDataProvider
    • IAffectedDataProviderExecuteDefinition
    • IAlertLevel
    • IChartCategory
    • IChartCategoryGroup
    • IChartData
    • IChartGroup
    • IChartPoint
    • IDataComment
    • IDataProvider
    • IDataProviderDefinition
    • IDataProviderNode
    • IDataProviderView
    • IDimension
    • IDimensionAttribute
    • IDimensionAttributes
    • IDimensionGridCell
    • IDimensionHierarchy
    • IDimensions
    • IDrillState
    • IDrillStates
    • IDrillStateTuple
    • IExecuteDefinition
    • IExportDocument
    • IF4Value
    • IF4Values
    • IFilterableInfoObject
    • IFlatF4Value
    • IGrid
    • IGridCell
    • IGridCell<T>
    • IGridData
    • IGridDefinition
    • IHierarchyF4Value
    • IInfoObject
    • IInfoObjects<T>
    • IKeyFigure
    • IKeyFigures
    • InfoObjectDataType
    • InfoObjectsExtensions
    • InfoObjectSortMode
    • IPositionableInfoObject<T>
    • IPositionableInfoObjects<T>
    • ISortableInfoObject
    • ISortTuple
    • ISumGridCell
    • ITuple
    • IUsedConnection
    • IUsedConnections
    • IValueGridCell
    • IVariable
    • IVariables
    • KeyFigure
    • KeyFigureAggregation
    • KeyFigureCalculationTime
    • KeyFigureExtensions
    • OpenBiDataProviderExtensions
    • OpenBiDataProviderViewExtensions
    • OpenBiRequestExtensions
    • SortTuple
    • Variable
    • VariableEntryType
    • VariableSelection
    • VariableType
  • BiExcellence.OpenBi.Api.Commands.DataProviders.Internal
    • DataProviderDefinitionJsonImpl
    • DataProviderUtils
  • BiExcellence.OpenBi.Api.Commands.DatastoreObjects
    • DatastoreObject
    • DatastoreObjectTypes
    • IDatastoreObject
    • OpenBiDatastoreObjectExtensions
  • BiExcellence.OpenBi.Api.Commands.DatastoreObjects.Internal
    • DatastoreObjectJsonImpl
  • BiExcellence.OpenBi.Api.Commands.Downloads
    • Download
    • IDownload
    • OpenBiDownloadExtensions
  • BiExcellence.OpenBi.Api.Commands.Downloads.Internal
    • DownloadJsonImpl
  • BiExcellence.OpenBi.Api.Commands.Entities
    • BaseEntity
    • Entity
    • IBaseEntity
    • IBaseEntityAssignment
    • IEntity
    • OpenBiEntityExtensions
  • BiExcellence.OpenBi.Api.Commands.Entities.Internal
    • BaseEntityJsonImpl
    • EntityJsonImpl
  • BiExcellence.OpenBi.Api.Commands.Files
    • OpenBiSessionFileExtensions
  • BiExcellence.OpenBi.Api.Commands.HostHeaders
    • HostHeader
    • IHostHeader
    • OpenBiHostHeaderExtensions
  • BiExcellence.OpenBi.Api.Commands.HostHeaders.Internal
    • HostHeaderJsonImpl
  • BiExcellence.OpenBi.Api.Commands.Inquiries
    • IInquirer
    • IInquiry
    • IInquiryField
    • OpenBiInquirerExtensions
    • OpenBiInquiryExtensions
  • BiExcellence.OpenBi.Api.Commands.LanguageTexts
    • ILanguageText
    • ILanguageTextValue
    • LanguageText
    • LanguageTextValue
    • OpenBiLanguageTextExtensions
  • BiExcellence.OpenBi.Api.Commands.LanguageTexts.Internal
    • LanguageTextJsonImpl
    • LanguageTextValueJsonImpl
  • BiExcellence.OpenBi.Api.Commands.LicenseInformation
    • ILicenseInformation
    • ILicenseInformationComponent
    • OpenBiLicenseInformationExtensions
  • BiExcellence.OpenBi.Api.Commands.MajaAi
    • IMajaEntity
    • IMajaGrammar
    • IMajaQueryAnswer
    • IMajaTalent
    • IMajaTalentCategory
    • IPossibleUserReply
    • MajaQueryAnswerAction
    • MajaQueryAnswerProposalType
    • News
    • OpenBiMajaExtensions
    • PossibleUserReplyControlType
    • PossibleUserReplyType
    • WeatherDetails
    • WeatherForecast
  • BiExcellence.OpenBi.Api.Commands.MajaAi.Internal
    • MajaGrammarJsonImpl
    • MajaTalentCategoryJsonImpl
    • MajaTalentJsonImpl
  • BiExcellence.OpenBi.Api.Commands.MapDimensions
    • IMapDimension
    • MapDimension
    • OpenBiMapDimensionExtensions
  • BiExcellence.OpenBi.Api.Commands.MapDimensions.Internal
    • MapDimensionJsonImpl
  • BiExcellence.OpenBi.Api.Commands.MasterData
    • IMasterData
    • IMasterDataAttribute
    • IMasterDataAttributes
    • IMasterDataHierarchy
    • IMasterDataHierarchyMemberNode
    • IMasterDataHierarchyNode
    • IMasterDataHierarchyTextNode
    • MasterData
    • MasterDataAttribute
    • MasterDataAttributes
    • MasterDataHierarchy
    • MasterDataHierarchyMemberNode
    • MasterDataHierarchyNodeExtensions
    • MasterDataHierarchyTextNode
    • OpenBiMasterDataExtensions
  • BiExcellence.OpenBi.Api.Commands.Organisations
    • IOrganisation
    • OpenBiOrganisationExtensions
    • Organisation
  • BiExcellence.OpenBi.Api.Commands.Organisations.Internal
    • OrganisationJsonImpl
  • BiExcellence.OpenBi.Api.Commands.RoleContents
    • IRoleContent
    • IRoleContentElement
    • IRoleContentElementCmsContent
    • IRoleContentElementHistory
    • IRoleContentHistory
    • OpenBiRoleContentExtensions
    • RoleContent
    • RoleContentElement
    • RoleContentElementCmsContent
    • RoleContentExtensions
  • BiExcellence.OpenBi.Api.Commands.Roles
    • IRole
    • IRoleAssignment
    • OpenBiRoleExtensions
    • Role
  • BiExcellence.OpenBi.Api.Commands.Roles.Internal
    • RoleAssignmentJsonImpl
    • RoleJsonImpl
  • BiExcellence.OpenBi.Api.Commands.ServerSettings
    • IServerSettingParameter
    • IServerSettingParameters
    • IServerSettings
    • OpenBiServerSettingsExtensions
    • ServerSettingParameter
  • BiExcellence.OpenBi.Api.Commands.TableAttributes
    • BooleanTableAttribute
    • DateTimeTableAttribute
    • DoubleTableAttribute
    • ICustomAttributes
    • IntegerTableAttribute
    • ITableAttribute
    • ITableAttribute<T>
    • ITableAttributeCache
    • ITableAttributes
    • ITableAttributes<T>
    • OpenBiTableAttributeExtensions
    • StringTableAttribute
    • TableAttribute
    • TableAttributeAttribute
    • TableAttributes
    • TableAttributes<T>
  • BiExcellence.OpenBi.Api.Commands.TableAttributes.Internal
    • TableAttributeJsonImpl
    • TableAttributeUtils
  • BiExcellence.OpenBi.Api.Commands.Usergroups
    • IUsergroup
    • IUsergroupAssignment
    • OpenBiUsergroupExtensions
    • Usergroup
  • BiExcellence.OpenBi.Api.Commands.Usergroups.Internal
    • UsergroupAssignmentJsonImpl
    • UsergroupJsonImpl
  • BiExcellence.OpenBi.Api.Commands.Users
    • IUser
    • OpenBiUserExtensions
    • User
  • BiExcellence.OpenBi.Api.Commands.Users.Internal
    • UserJsonImpl
  • BiExcellence.OpenBi.Api.Internal
    • ApiFieldAttribute
    • EnumValueAttribute
    • Utils

Class Utils

Utilities methods for converting values from and to the command API

Inheritance
object
Utils
Namespace: BiExcellence.OpenBi.Api.Internal
Assembly: BiExcellence.OpenBi.Api.dll
Syntax
public static class Utils

Methods

BooleanToString(bool)

Converts a bool to a string. Example: true => "X" false => ""

Declaration
public static string BooleanToString(bool boolean)
Parameters
Type Name Description
bool boolean

The boolean value.

Returns
Type Description
string

The converted string.

DateTimeOffsetToString(DateTimeOffset)

Converts a DateTimeOffset to a string.

Declaration
public static string DateTimeOffsetToString(DateTimeOffset dateTimeOffset)
Parameters
Type Name Description
DateTimeOffset dateTimeOffset

The date value.

Returns
Type Description
string

The converted string.

FireEvent<T>(object, string, T)

Fires the event of the target object with args.

Declaration
public static void FireEvent<T>(this object target, string eventName, T args) where T : EventArgs
Parameters
Type Name Description
object target

The object which declared the event (also the sender).

string eventName

The event name.

T args

The event args.

Type Parameters
Name Description
T

The event args type.

FireEvent<T>(object, string, object, T)

Fires the event of the target object with args.

Declaration
public static void FireEvent<T>(this object target, string eventName, object sender, T args) where T : EventArgs
Parameters
Type Name Description
object target

The object which declared the event.

string eventName

The event name.

object sender

The sender object for the event.

T args

The event args.

Type Parameters
Name Description
T

The event args type

GetCustomAttributeIncludingBaseInterfaces<T>(Type)

Returns the first attribute also from interface for the generic type.

Declaration
public static T? GetCustomAttributeIncludingBaseInterfaces<T>(this Type type) where T : Attribute
Parameters
Type Name Description
Type type
Returns
Type Description
T
Type Parameters
Name Description
T

The attribute type.

GetCustomAttributesIncludingBaseInterfaces<T>(Type)

Returns all attributes also from interfaces for the generic type.

Declaration
public static IEnumerable<T> GetCustomAttributesIncludingBaseInterfaces<T>(this Type type) where T : Attribute
Parameters
Type Name Description
Type type
Returns
Type Description
IEnumerable<T>
Type Parameters
Name Description
T

The attribute type.

GetOrAddSerializable<T>(IOpenBiRequest, Func<T>)

Returns an existing serializeable or creates a new one.

Declaration
public static T GetOrAddSerializable<T>(this IOpenBiRequest openBiRequest, Func<T> createSerializer) where T : IOpenBiRequestSerializable
Parameters
Type Name Description
IOpenBiRequest openBiRequest

The request.

Func<T> createSerializer

The func to create a new serializable if there isn't an existing one.

Returns
Type Description
T
Type Parameters
Name Description
T

The serializeable type.

StringToBoolean(string?)

Converts a string to a bool.

Declaration
public static bool StringToBoolean(string? str)
Parameters
Type Name Description
string str

The string value.

Returns
Type Description
bool

true when "X" otherwise false.

StringToDateTimeOffset(string?)

Converts a string to a DateTimeOffset.

Declaration
public static DateTimeOffset? StringToDateTimeOffset(string? str)
Parameters
Type Name Description
string str

The string.

Returns
Type Description
DateTimeOffset?

The converted DateTimeOffset or null.

ToArray(JsonElement)

Tries to find a JsonElement inside of the JsonElement. Examples: 1 => [1] [1,2,3] => [1,2,3] {"list":[1,2,3]} => [1,2,3]

Declaration
public static IEnumerable<JsonElement> ToArray(this JsonElement element)
Parameters
Type Name Description
JsonElement element

The json element.

Returns
Type Description
IEnumerable<JsonElement>

An enumerable over the array.

ToBoolean(JsonElement)

Converts a JsonElement to a bool. Examples: true => true "X" => true (other) => false

Declaration
public static bool? ToBoolean(this JsonElement element)
Parameters
Type Name Description
JsonElement element

The json element.

Returns
Type Description
bool?

The converted bool or null

ToByteArray(JsonElement)

Converts a JsonElement to a byte array. Examples: "(base 64)" => byte[] (other) => null

Declaration
public static byte[]? ToByteArray(this JsonElement element)
Parameters
Type Name Description
JsonElement element

The json element.

Returns
Type Description
byte[]

The converted byte array or null

ToDateTimeOffset(JsonElement)

Converts a JsonElement to a DateTimeOffset.

Declaration
public static DateTimeOffset? ToDateTimeOffset(this JsonElement element)
Parameters
Type Name Description
JsonElement element

The json element.

Returns
Type Description
DateTimeOffset?

The converted DateTimeOffset or null

ToDouble(JsonElement)

Converts a JsonElement to a double.

Declaration
public static double? ToDouble(this JsonElement element)
Parameters
Type Name Description
JsonElement element

The json element.

Returns
Type Description
double?

The Converted double or null

ToEnum<TEnum>(JsonElement)

Converts a JsonElement to an enum.

Declaration
public static TEnum ToEnum<TEnum>(this JsonElement element) where TEnum : struct
Parameters
Type Name Description
JsonElement element

The json element.

Returns
Type Description
TEnum

The converted enum value or the default enum value for the enum type.

Type Parameters
Name Description
TEnum

The enum type.

ToInteger(JsonElement)

Converts a JsonElement to a int.

Declaration
public static int? ToInteger(this JsonElement element)
Parameters
Type Name Description
JsonElement element

The json element.

Returns
Type Description
int?

The converted int or null.

ToLong(JsonElement)

Converts a JsonElement to a long.

Declaration
public static long? ToLong(this JsonElement element)
Parameters
Type Name Description
JsonElement element

The json element.

Returns
Type Description
long?

The converted long or null.

ToObject(JsonElement)

Converts a JsonElement to a .NET object.

Declaration
public static object? ToObject(this JsonElement element)
Parameters
Type Name Description
JsonElement element

The json element.

Returns
Type Description
object

The converted .NET object or the raw json text.

In This Article
Back to top bi excellence software GmbH