public void Load(ClientObject clientObject, LoadOption loadOption)
        {
            Utility.ValidateContext(this, clientObject);

            if (loadOption == null)
            {
                loadOption = new LoadOption();
            }

            QueryInfo queryOption = new QueryInfo();

            if (!string.IsNullOrEmpty(loadOption.Select))
            {
                queryOption.Select = this.ParseSelectExpand(loadOption.Select);
            }

            if (!string.IsNullOrEmpty(loadOption.Expand))
            {
                queryOption.Expand = this.ParseSelectExpand(loadOption.Expand);
            }

            queryOption.Skip = loadOption.Skip;
            queryOption.Top  = loadOption.Top;

            var action = ActionFactory.CreateQueryAction(this, clientObject, queryOption);

            this._PendingRequest.AddActionResultHandler(action, clientObject);
        }
Example #2
0
        public void Add(ClientObject clientObject)
        {
            ITrackedObject trackedObj = clientObject as ITrackedObject;

            if (trackedObj != null)
            {
                if (string.IsNullOrEmpty(trackedObj._ReferenceId))
                {
                    trackedObj._KeepReference();
                    ActionFactory.CreateInstantiateAction(this.m_context, clientObject);
                }
            }
        }
Example #3
0
        public ClientObject(ClientRequestContext context, ObjectPath objectPath)
        {
            Utility.CheckArgumentNull(context, "context");
            this.m_context    = context;
            this.m_objectPath = objectPath;
            if (this.m_objectPath != null)
            {
                // If object is being created during a normal API flow (and NOT as part of processing load results),
                // create an instantiation action and call keepReference, if applicable
                if (!context.ProcessingResult)
                {
                    ActionFactory.CreateInstantiateAction(context, this);
                }
            }

            this.m_loadedPropertyNames = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
        }
Example #4
0
        public void Remove(ClientObject clientObject)
        {
            if (this.m_context._RootObject == null)
            {
                return;
            }

            ITrackedObject trackedObject = clientObject as ITrackedObject;

            if (trackedObject == null)
            {
                return;
            }

            string referenceId = trackedObject._ReferenceId;

            if (string.IsNullOrEmpty(referenceId))
            {
                return;
            }

            ActionFactory._CreateMethodAction(this.m_context, this.m_context._RootObject, "_RemoveReference", OperationType.Read, new object[] { referenceId });
        }
 public void Trace(string message)
 {
     ActionFactory.CreateTraceAction(this, message);
 }