/// <summary> /// Merges the results from one object with the other. Will be typically used when: /// - The same object was requested twice in a batch /// - Refresh of an added object /// </summary> /// <param name="input"><see cref="TransientObject"/> to merge with this <see cref="TransientObject"/></param> internal void Merge(TransientObject input) { // Copy the basic properties foreach (var prop in input.current) { if (prop.Value is TransientDictionary) { (current[prop.Key] as TransientDictionary).Merge(prop.Value as TransientDictionary); } else { SetValue(prop.Value, prop.Key); // Handle the model properties if (prop.Value is IDataModelParent) { // Ensure the merged model property parent is this model (current[prop.Key] as IDataModelParent).Parent = (IDataModelParent)this; } } } // Update the BatchRequestId, too in order to // refresh the object in the collection with // the latest requested one BatchRequestId = input.BatchRequestId; }
/// <summary> /// Converts the current strongly typed object to a dynamic object /// </summary> /// <returns>The dynamic object from current strongly typed object</returns> public dynamic AsDynamic() { // TODO: Evaluate if we really need this method return(TransientObject.AsDynamic(this)); }