Show / Hide Table of Contents

Class BusinessObject

General abstract class for Business Objects for Energy (BO4E)

Inheritance
System.Object
BusinessObject
Angebot
Ansprechpartner
Benachrichtigung
EncryptedObject
Energiemenge
Geschaeftspartner
Kosten
LogObject
Marktlokation
Messlokation
Preisblatt
Rechnung
Region
Vertrag
Zaehler
Report
TestMultiLangJson.MultiLangBo
Namespace: BO4E.BO
Assembly: BO4Enet.dll
Syntax
public abstract class BusinessObject : IEquatable<BusinessObject>

Constructors

| Improve this Doc View Source

BusinessObject()

generates the BO4E boTyp attribute value (class name as upper case)

Declaration
protected BusinessObject()

Fields

| Improve this Doc View Source

guid

allows adding a GUID to Business Objects for tracking across systems

Declaration
public string guid
Field Value
Type Description
System.String
| Improve this Doc View Source

USER_PROPERTIES_NAME

Fields that are not part of the BO4E-definition are stored in a element, that is accessable under the key defined in userPropertiesName.

Declaration
public const string USER_PROPERTIES_NAME = null
Field Value
Type Description
System.String
Examples
{
   "boTyp": "MESSLOKATION",
   "versionStruktur": 1,
   "messLokationsId": "DE123...",
   "irgendwas unbekanntes": "xyz"
}

is mapped to

{
   "boTyp": "MESSLOKATION",
   "versionStruktur": 1,
   "messLokationsId": "DE123...",
   "userProperties":
   {
       "irgendwas unbekanntes": "xyz"
   }
}

This keeps the Business Object simple but allows for user specific arguments beyond the BO4E standard to be passed along.

| Improve this Doc View Source

versionStruktur

obligatory version of the BO4E definition. Currently hard coded to 1

Declaration
public int versionStruktur
Field Value
Type Description
System.Int32
Examples

1

Properties

| Improve this Doc View Source

BoTyp

obligatory type of the business object in UPPER CASE

Declaration
public string BoTyp { get; set; }
Property Value
Type Description
System.String
Examples

'MESSLOKATION', 'MARKTLOKATION'

| Improve this Doc View Source

UserProperties

User properties (non bo4e standard)

Declaration
public IDictionary<string, JToken> UserProperties { get; set; }
Property Value
Type Description
IDictionary<System.String, JToken>

Methods

| Improve this Doc View Source

DeserializationFixes(StreamingContext)

converts BoTyp to upper case.

Declaration
protected void DeserializationFixes(StreamingContext context)
Parameters
Type Name Description
StreamingContext context
| Improve this Doc View Source

Equals(BusinessObject)

BO4E Business Objects are considered equal iff all of their elements/fields are equal.

Declaration
public bool Equals(BusinessObject b)
Parameters
Type Name Description
BusinessObject b

another Business Object

Returns
Type Description
System.Boolean
true
iff b has the same type as this object and all elements

of this and object b are equal;

false
otherwise

| Improve this Doc View Source

Equals(Object)

BO4E Business Objects are considered equal iff all of their elements/fields are equal.

Declaration
public override bool Equals(object b)
Parameters
Type Name Description
System.Object b

another object

Returns
Type Description
System.Boolean
true
iff b has the same type as this object and all elements of this and object b are equal;
false
otherwise
| Improve this Doc View Source

GetBoKeyNames()

(Some) Business Objects do have keys that should identify them in a unique manner across multiple systems. This method returns a list of these keys. The list contains the key names as they are serialised in JSON. This means that the fields PropertyName is part of the list if JsonPropertyAttribute.PropertyName is set in the Business Objects definition. Please do not use this method trying to access the actual key values. Use the GetBoKeys() or GetBoKeyProps(Type) for this purpose. The list is sorted by the JsonPropertyAttribute.Order, assuming 0 if not specified.

Declaration
public List<string> GetBoKeyNames()
Returns
Type Description
List<System.String>

A list of the names (not the values) of the (composite) Business Object key or an empty list if no key attributes are defined.

Examples
    Marktlokation malo = ... some initialisation code ...;
    malo.GetBoKeyNames()

[ "marktlokationsId" ]

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

GetBoKeyNames(Type)

Same as GetBoKeyNames(Type) but allows static calling with a Business Object Type provided.

Declaration
public static List<string> GetBoKeyNames(Type boType)
Parameters
Type Name Description
Type boType

Business Object Type

Returns
Type Description
List<System.String>

A list just like the result of GetBoKeyNames(Type)

| Improve this Doc View Source

GetBoKeyProps(Type)

Get a list of FieldInfo objects that contain the key of a Business Object. The list is sorted by the JsonPropertyAttribute.Order, assuming 0 if not specified.

Declaration
public static List<PropertyInfo> GetBoKeyProps(Type boType)
Parameters
Type Name Description
Type boType

Business Object type

Returns
Type Description
List<PropertyInfo>

A list of FieldInfos to be used for accessing the key values.

| Improve this Doc View Source

GetBoKeys()

Get a dictionary containing the key values of this Business Object. The dictionary has the JsonPropertyAttribute.PropertyName or FieldName of the key as key and the actual key value as value.

Declaration
public Dictionary<string, object> GetBoKeys()
Returns
Type Description
Dictionary<System.String, System.Object>

A dictionary with key value pairs.

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

GetBoTyp()

return BoTyp (as string, not as type)

Declaration
public string GetBoTyp()
Returns
Type Description
System.String
| Improve this Doc View Source

GetExpandableFieldNames(String)

GetExpandablePropertyNames(Type)

Declaration
public static Dictionary<string, Type> GetExpandableFieldNames(string boTypeName)
Parameters
Type Name Description
System.String boTypeName

name of the business object as string

Returns
Type Description
Dictionary<System.String, Type>

GetExpandablePropertyNames(Type)

| Improve this Doc View Source

GetExpandablePropertyNames(Type)

This method returns information about the object structure, especially if there are nested field, that could be used, e.g. to expand OData queries.

Declaration
public static Dictionary<string, Type> GetExpandablePropertyNames(Type boType)
Parameters
Type Name Description
Type boType

valid business object type

typeof(Marktlokation)
Returns
Type Description
Dictionary<System.String, Type>

A dictionary with field names as keys (or the different JSON property name if set) and the type of the property as value. Nesting and different layers are denoted by using "."

| Improve this Doc View Source

GetExpandablePropertyNames(Type, Boolean)

recursive function to return all expandable fields for a given type type. Set rootLevel when calling from outside the function itself.

Declaration
protected static Dictionary<string, Type> GetExpandablePropertyNames(Type type, bool rootLevel = true)
Parameters
Type Name Description
Type type

Type inherited from Business Object

System.Boolean rootLevel

true iff calling from outside the function itself / default

Returns
Type Description
Dictionary<System.String, Type>

HashSet of strings

| Improve this Doc View Source

GetHashCode()

override hash code generation

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

hash code as int

| Improve this Doc View Source

GetJsonSchema(Type)

returns a JSON scheme for the given type boType

Declaration
public static JSchema GetJsonSchema(Type boType)
Parameters
Type Name Description
Type boType

a type derived from BusinessObject

Returns
Type Description
JSchema

a JSON scheme

| Improve this Doc View Source

GetJsonScheme()

returns a JSON scheme for the Business Object

Declaration
public JSchema GetJsonScheme()
Returns
Type Description
JSchema

a JSON scheme

| Improve this Doc View Source

GetURI(Boolean)

Get a BO4E compliant URI for this business object.

Declaration
public Bo4eUri GetURI(bool includeUserProperties = false)
Parameters
Type Name Description
System.Boolean includeUserProperties
Returns
Type Description
Bo4eUri

a BO4E compliant URI object

| Improve this Doc View Source

IsValid()

Tests if the object does contain all mandatory information / fields. To do so, the function tries to serialize the object as JSON. If the serialization fails due to fields that are but not filled it returns false and true otherwise.

Declaration
public virtual bool IsValid()
Returns
Type Description
System.Boolean

true if COM object is compatible with BO4E standards

| Improve this Doc View Source

SetBoTyp(String)

This method is just to make sure the mapping actually makes sense.

Declaration
protected void SetBoTyp(string s)
Parameters
Type Name Description
System.String s

name of the business object

Extension Methods

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