Show / Hide Table of Contents

Class BoMapper

This class maps generic JObjects to BO4E business objects.

Inheritance
System.Object
BoMapper
Namespace: BO4E
Assembly: BO4Enet.dll
Syntax
public abstract class BoMapper : object

Fields

| Improve this Doc View Source

packagePrefix

namespace.subnamespace for the BO4E package. maybe there's a more elegant way using self reflection.

Declaration
public static readonly string packagePrefix
Field Value
Type Description
System.String

Methods

| Improve this Doc View Source

GetAnnotatedFields(String)

Shortcut for GetAnnotatedFields(String, Type) with DataCategoryAttribute as default.

Declaration
public static FieldInfo[] GetAnnotatedFields(string boName)
Parameters
Type Name Description
System.String boName

name of the business object in title caseMesslokation

Returns
Type Description
FieldInfo[]

Array of FieldInfos

| Improve this Doc View Source

GetAnnotatedFields(String, Type)

Get those fields of a business object that do have attributes/annotations. The result is ordered by the JsonProperty->Order value (assuming 0 if null).

Declaration
public static FieldInfo[] GetAnnotatedFields(string boName, Type attributeType)
Parameters
Type Name Description
System.String boName

name of the business object in title caseMesslokation

Type attributeType

type of the attribute/annotation you're interested intypeof(DataCategoryAttribute)

Returns
Type Description
FieldInfo[]

Array of FieldInfos

| Improve this Doc View Source

GetAnnotatedFields(Type)

Declaration
public static FieldInfo[] GetAnnotatedFields(Type type)
Parameters
Type Name Description
Type type
Returns
Type Description
FieldInfo[]
| Improve this Doc View Source

GetAnnotatedFields(Type, Type)

Get those fields of a business object that do have attributes/annotations. The result is ordered by the JsonProperty->Order value (assuming 0 if null).

Declaration
public static FieldInfo[] GetAnnotatedFields(Type boType, Type attributeType)
Parameters
Type Name Description
Type boType

type of the business object

Type attributeType

type of the attribute/annotation you're interested intypeof(DataCategoryAttribute)

Returns
Type Description
FieldInfo[]

Array of FieldInfos

| Improve this Doc View Source

GetJsonSchemeFor(String)

Get JSON Scheme for given Business Object name

Declaration
public static JSchema GetJsonSchemeFor(string businessObjectName)
Parameters
Type Name Description
System.String businessObjectName

Business Object name (e.g. "Messlokation")

Returns
Type Description
JSchema

A JSON scheme to be used for validation purposes or null for invalid arguments.

See Also
GetJsonSchemeFor(Type)
| Improve this Doc View Source

GetJsonSchemeFor(Type)

Get JSON Scheme for given Business Object type

Declaration
public static JSchema GetJsonSchemeFor(Type businessObjectType)
Parameters
Type Name Description
Type businessObjectType

Business Object type (e.g. typeof(BO4E.BO.Messlokation)

Returns
Type Description
JSchema

A JSON scheme to be used for validation purposes.

See Also
GetJsonSchemeFor(String)
| Improve this Doc View Source

GetTypeForBoName(String)

Returns a Type for given Business Object name. This method is useful to avoid stringified code.

Declaration
public static Type GetTypeForBoName(string businessObjectName)
Parameters
Type Name Description
System.String businessObjectName

name of a business object; is lenient regarding upper/lower case

Returns
Type Description
Type

a BusinessObjectType or null if no matching type was found

Examples
BoMapper.GetTypeForBoName("Energiemenge"); // returns typeof(BO4E.BO.Energiemenge)
BoMapper.GetTypeForBoName("eNeRgIeMENgE"); // returns typeof(BO4E.BO.Energiemenge)
BoMapper.GetTypeForBoName("non existent BO"); // returns null
| Improve this Doc View Source

GetValidBoNames()

Get a list of those strings that are known BO4E types (e.g. "Messlokation", "Energiemenge"...)

Declaration
public static HashSet<string> GetValidBoNames()
Returns
Type Description
HashSet<System.String>

a list of valid BO4E names; upper/lower case sensitive

| Improve this Doc View Source

MapObject(JObject, LenientParsing)

shortcut for MapObject with an empty userProperties white list

Declaration
public static BusinessObject MapObject(JObject jobject, LenientParsing lenient = default(LenientParsing))
Parameters
Type Name Description
JObject jobject

business object json

LenientParsing lenient

lenient parsing flags

Returns
Type Description
BusinessObject

MapObject(String, JObject, LenientParsing)

| Improve this Doc View Source

MapObject(JObject, HashSet<String>, LenientParsing)

shortcut for MapObject(String, JObject, LenientParsing) iff jobject has key 'boTyp'

Declaration
public static BusinessObject MapObject(JObject jobject, HashSet<string> userPropertiesWhiteList, LenientParsing lenient = default(LenientParsing))
Parameters
Type Name Description
JObject jobject

business object json

HashSet<System.String> userPropertiesWhiteList

white list of non BO4E standard field you'd like to have de-serialised

LenientParsing lenient

lenient parsing flags

Returns
Type Description
BusinessObject

MapObject(String, JObject, LenientParsing)

| Improve this Doc View Source

MapObject(String, JObject, LenientParsing)

MapObject(String, JObject, HashSet<String>, LenientParsing) with empty user properties white list

Declaration
public static BusinessObject MapObject(string businessObjectName, JObject jobject, LenientParsing lenient = default(LenientParsing))
Parameters
Type Name Description
System.String businessObjectName
JObject jobject
LenientParsing lenient
Returns
Type Description
BusinessObject
| Improve this Doc View Source

MapObject(String, JObject, HashSet<String>, LenientParsing)

MapObject(Type, JObject, HashSet<String>, LenientParsing)

Declaration
public static BusinessObject MapObject(string businessObjectName, JObject jobject, HashSet<string> userPropertiesWhiteList, LenientParsing lenient = default(LenientParsing))
Parameters
Type Name Description
System.String businessObjectName
JObject jobject
HashSet<System.String> userPropertiesWhiteList
LenientParsing lenient
Returns
Type Description
BusinessObject
| Improve this Doc View Source

MapObject(Type, JObject, LenientParsing)

MapObject(Type, JObject, HashSet<String>, LenientParsing) with empty user properties white list

Declaration
public static BusinessObject MapObject(Type businessObjectType, JObject jobject, LenientParsing lenient = default(LenientParsing))
Parameters
Type Name Description
Type businessObjectType
JObject jobject
LenientParsing lenient
Returns
Type Description
BusinessObject
| Improve this Doc View Source

MapObject(Type, JObject, HashSet<String>, LenientParsing)

This method tries to map the given jobject to a BO4E style Business Object of a given type. It works using reflection.

Declaration
public static BusinessObject MapObject(Type businessObjectType, JObject jobject, HashSet<string> userPropertiesWhiteList, LenientParsing lenient = default(LenientParsing))
Parameters
Type Name Description
Type businessObjectType

type of the business object

JObject jobject

JObject that should be mapped to a BO4E business object.

HashSet<System.String> userPropertiesWhiteList

white list of non BO4E standard field you'd like to have de-serialised

LenientParsing lenient

allow less strict input objects

Returns
Type Description
BusinessObject
  • null iff there is no BO4E Business Object that matches the provided businessObjectName. Check the case sensitive spelling of the business object name
  • a BO4E business object (BusinessObject) of the type provided in businessObjectName
| Improve this Doc View Source

MapObject<BusinessObjectType>(JObject, LenientParsing)

MapObject(Type, JObject, HashSet<String>, LenientParsing)

Declaration
public static BusinessObjectType MapObject<BusinessObjectType>(JObject jobject, LenientParsing lenient = default(LenientParsing))
Parameters
Type Name Description
JObject jobject
LenientParsing lenient
Returns
Type Description
BusinessObjectType
Type Parameters
Name Description
BusinessObjectType
| Improve this Doc View Source

MapObject<BusinessObjectType>(JObject, HashSet<String>, LenientParsing)

MapObject(Type, JObject, HashSet<String>, LenientParsing)

Declaration
public static BusinessObjectType MapObject<BusinessObjectType>(JObject jobject, HashSet<string> userPropertiesWhiteList, LenientParsing lenient = default(LenientParsing))
Parameters
Type Name Description
JObject jobject

MapObject(Type, JObject, HashSet<String>, LenientParsing)

HashSet<System.String> userPropertiesWhiteList

MapObject(Type, JObject, HashSet<String>, LenientParsing)

LenientParsing lenient

MapObject(Type, JObject, HashSet<String>, LenientParsing)

Returns
Type Description
BusinessObjectType

MapObject(Type, JObject, HashSet<String>, LenientParsing)

Type Parameters
Name Description
BusinessObjectType

type of return value

Extension Methods

BusinessObjectExtensions.DeepClone<T>(T)
COMExtensions.DeepClone<T>(T)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX