BO4E/BoMapper.cs
/// <summary>
///     This method tries to map the given jobject to a BO4E style
///     Business Object of a given type. It works using reflection.
/// </summary>
/// If the mapping fails, there either is no BO with the given name or
/// you mixed up or forgot some attributes. Most of assertion errors
/// are likely to happen due to misspelled and case sensitive attributes.
/// The assertion error message should be a good hint to what is wrong.
/// If the method passes without an assertion error, there are at
/// least no unknown or wrong attributes.
/// <param name="jobject">JObject that should be mapped to a BO4E business object.</param>
/// <param name="userPropertiesWhiteList">white list of non BO4E standard field you'd like to have de-serialised</param>
/// <param name="businessObjectType">type of the business object</param>
/// <param name="lenient">allow less strict input objects</param>
/// <returns>
///     <list type="bullet">
///         <item>
///             <description>
///                 null iff there is no BO4E Business Object that matches the provided businessObjectName. Check
///                 the case sensitive spelling of the business object name
///             </description>
///         </item>
///         <item>
///             <description>
///                 a BO4E business object (<see cref="BusinessObject" />) of the type provided in
///                 businessObjectName
///             </description>
///         </item>
///     </list>
/// </returns>
This method tries to map the given jobject to a BO4E style
Business Object of a given type. It works using reflection.
This method tries to map the given jobject to a BO4E style Business Object of a given type . It works using reflection .
[Obsolete(
            "DEPRECATED! Please use the overloaded method MapObject<T>(...) or MapObject(Type t,...) that accept types, not strings.")]
        public static BusinessObject MapObject(Type businessObjectType, JObject jobject,
            HashSet<string> userPropertiesWhiteList, LenientParsing lenient = LenientParsing.STRICT)
        {
            if (!businessObjectType.IsSubclassOf(typeof(BusinessObject)))
                throw new ArgumentException("Mapping is only allowed for types derived from BO4E.BO.BusinessObject");
            if (lenient == LenientParsing.STRICT && userPropertiesWhiteList.Count == 0)
                return (BusinessObject)jobject.ToObject(businessObjectType);
            var settings = lenient.GetJsonSerializerSettings();
            return (BusinessObject)JsonConvert.DeserializeObject(jobject.ToString(), businessObjectType, settings);
        }
[ Obsolete ( " " ) ] public static BusinessObject MapObject ( Type businessObjectType , JObject jobject , HashSet < string > userPropertiesWhiteList , LenientParsing lenient = LenientParsing . STRICT ) { if ( ! businessObjectType . IsSubclassOf ( typeof ( BusinessObject ) ) ) throw new ArgumentException ( " " ) ; if ( lenient == LenientParsing . STRICT && userPropertiesWhiteList . Count == 0 ) return ( BusinessObject ) jobject . ToObject ( businessObjectType ) ; var settings = lenient . GetJsonSerializerSettings ( ) ; return ( BusinessObject ) JsonConvert . DeserializeObject ( jobject . ToString ( ) , businessObjectType , settings ) ; }
This method tries to map the given jobject to a BO4E style
Business Object of a given type.
This method tries to map the given jobject to a BO4E style Business Object of a given type .
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 (
) of the type provided in
businessObjectName
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 ( ) of the type provided in businessObjectName
businessObjectType
Type
type of the business object
type of the business object
jobject
JObject
JObject that should be mapped to a BO4E business object.
JObject that should be mapped to a BO4E business object .
userPropertiesWhiteList
HashSet<string>
white list of non BO4E standard field you'd like to have de-serialised
white list of non BO4E standard field you ' d like to have de - serialised
lenient
LenientParsing
allow less strict input objects
allow less strict input objects