Mongo.Context.MongoDSPUpdateProvider.SetValue C# (CSharp) Method

SetValue() public method

public SetValue ( object targetResource, string propertyName, object propertyValue ) : void
targetResource object
propertyName string
propertyValue object
return void
        public override void SetValue(object targetResource, string propertyName, object propertyValue)
        {
            base.SetValue(targetResource, propertyName, propertyValue);

            var resource = targetResource as DSPResource;
            var pendingChange = this.pendingChanges.SingleOrDefault(x => x.Resource == resource && x.Action == InsertDocument);
            if (pendingChange == null)
            {
                pendingChange = this.pendingChanges.SingleOrDefault(x => x.Resource == resource && x.Action == UpdateDocument);
                if (pendingChange == null)
                {
                    pendingChange = new ResourceChange(resource.ResourceType.Name, resource, UpdateDocument);
                    this.pendingChanges.Add(pendingChange);
                }
            }

            var properties = pendingChange.ModifiedProperties;
            if (properties.ContainsKey(propertyName))
                properties[propertyName] = propertyValue;
            else
                properties.Add(propertyName, propertyValue);
        }