Ejemplo n.º 1
0
 /// <summary>
 /// Creates an instance of the object type specified and populates the object structure represented by this dynamic object.
 /// </summary>
 /// <param name="dynamicObject">The <see cref="DynamicObject"/> to be mapped.</param>
 /// <typeparam name="T">Type of object to be created.</typeparam>
 /// <param name="mapper">Optional instance of dynamic object mapper.</param>
 public static T CreateObject <T>(this DynamicObject dynamicObject, IDynamicObjectMapper?mapper = null)
 => (mapper ?? new DynamicObjectMapper()).Map <T>(dynamicObject);
Ejemplo n.º 2
0
 /// <summary>
 /// Returns <see langword="true"/> if this <see cref="DynamicObject"/> wraps a single value, <see langword="false"/> otherwise.
 /// </summary>
 public static bool IsSingleValueWrapper(this DynamicObject dynamicObject)
 => dynamicObject.CheckNotNull(nameof(dynamicObject)).PropertyCount == 1 &&
 string.IsNullOrEmpty(dynamicObject.PropertyNames.Single());
Ejemplo n.º 3
0
 /// <summary>
 /// Creates an instance of the object type specified and populates the object structure represented by this dynamic object.
 /// </summary>
 /// <param name="dynamicObject">The <see cref="DynamicObject"/> to be mapped.</param>
 /// <param name="type">Type of object to be created.</param>
 /// <param name="mapper">Optional instance of dynamic object mapper.</param>
 public static object CreateObject(this DynamicObject dynamicObject, Type type, IDynamicObjectMapper?mapper = null)
 => (mapper ?? new DynamicObjectMapper()).Map(dynamicObject, type);
Ejemplo n.º 4
0
 /// <summary>
 /// Creates an instance of the object represented by the dynamic object specified.
 /// </summary>
 /// <param name="dynamicObject">The <see cref="DynamicObject"/> to be mapped.</param>
 /// <remarks>Requires the Type property to be set on this dynamic object.</remarks>
 /// <param name="mapper">Optional instance of dynamic object mapper.</param>
 public static object?CreateObject(this DynamicObject dynamicObject, IDynamicObjectMapper?mapper = null)
 => (mapper ?? new DynamicObjectMapper()).Map(dynamicObject);
Ejemplo n.º 5
0
 public MetaObject(Expression expression, BindingRestrictions restrictions, DynamicObject dynamicObject)
     : base(expression, restrictions, dynamicObject)
 {
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates an instance of the object type specified and populates the object structure represented by this dynamic object.
 /// </summary>
 /// <param name="dynamicObject">The <see cref="DynamicObject"/> to be mapped.</param>
 /// <typeparam name="T">Type of object to be created.</typeparam>
 /// <param name="mapper">Optional instance of dynamic object mapper.</param>
 public static T CreateObject <T>(this DynamicObject dynamicObject, IDynamicObjectMapper mapper = null)
 {
     return((mapper ?? new DynamicObjectMapper()).Map <T>(dynamicObject));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates an instance of the object type specified and populates the object structure represented by this dynamic object.
 /// </summary>
 /// <param name="dynamicObject">The <see cref="DynamicObject"/> to be mapped.</param>
 /// <param name="type">Type of object to be created.</param>
 /// <param name="mapper">Optional instance of dynamic object mapper.</param>
 public static object CreateObject(this DynamicObject dynamicObject, Type type, IDynamicObjectMapper mapper = null)
 {
     return((mapper ?? new DynamicObjectMapper()).Map(dynamicObject, type));
 }