Ejemplo n.º 1
0
        public static ObjectPath _CreateGlobalObjectObjectPath(ClientRequestContext context)
        {
            ObjectPathInfo objectPathInfo = new ObjectPathInfo()
            {
                Id             = context._NextId(),
                ObjectPathType = ObjectPathType.GlobalObject,
                Name           = ""
            };

            return(new ObjectPath(objectPathInfo, null, false /*isCollection*/, false /*isInvalidAfterRequest*/));
        }
Ejemplo n.º 2
0
        public static ObjectPath _CreatePropertyObjectPath(ClientRequestContext context, ClientObject parent, string propertyName, bool isCollection, bool isInvalidAfterRequest)
        {
            ObjectPathInfo objectPathInfo = new ObjectPathInfo()
            {
                Id                 = context._NextId(),
                ObjectPathType     = ObjectPathType.Property,
                Name               = propertyName,
                ParentObjectPathId = parent._ObjectPath.ObjectPathInfo.Id,
            };

            return(new ObjectPath(objectPathInfo, parent._ObjectPath, isCollection, isInvalidAfterRequest));
        }
Ejemplo n.º 3
0
        public static ObjectPath _CreateIndexerObjectPathUsingParentPath(ClientRequestContext context, ObjectPath parentObjectPath, object[] args)
        {
            ObjectPathInfo objectPathInfo = new ObjectPathInfo()
            {
                Id                 = context._NextId(),
                ObjectPathType     = ObjectPathType.Indexer,
                Name               = "",
                ParentObjectPathId = parentObjectPath.ObjectPathInfo.Id,
                ArgumentInfo       = new ArgumentInfo()
            };

            objectPathInfo.ArgumentInfo.Arguments = args;
            return(new ObjectPath(objectPathInfo, parentObjectPath, false /*isCollection*/, false /*isInvalidAfterRequest*/));
        }
Ejemplo n.º 4
0
        public static ObjectPath _CreateMethodObjectPath(ClientRequestContext context, ClientObject parent, string methodName, OperationType operationType, object[] args, bool isCollection, bool isInvalidAfterRequest)
        {
            ObjectPathInfo objectPathInfo = new ObjectPathInfo()
            {
                Id                 = context._NextId(),
                ObjectPathType     = ObjectPathType.Method,
                Name               = methodName,
                ParentObjectPathId = parent._ObjectPath.ObjectPathInfo.Id,
                ArgumentInfo       = new ArgumentInfo()
            };
            List <ObjectPath> argumentObjectPaths = Utility.SetMethodArguments(context, objectPathInfo.ArgumentInfo, args);
            ObjectPath        ret = new ObjectPath(objectPathInfo, parent._ObjectPath, isCollection, isInvalidAfterRequest);

            ret.ArgumentObjectPaths = argumentObjectPaths;
            ret.IsWriteOperation    = (operationType != OperationType.Read);
            return(ret);
        }
Ejemplo n.º 5
0
        public static ObjectPath _CreateChildItemObjectPathUsingGetItemAt(ClientRequestContext context, ClientObject parent, JToken childItem, int index)
        {
            JToken indexFromServer = childItem[Constants.Index];

            if (!Utility._IsNullOrUndefined(indexFromServer))
            {
                index = indexFromServer.Value <int>();
            }

            ObjectPathInfo objectPathInfo = new ObjectPathInfo()
            {
                Id                 = context._NextId(),
                ObjectPathType     = ObjectPathType.Method,
                Name               = Constants.GetItemAt,
                ParentObjectPathId = parent._ObjectPath.ObjectPathInfo.Id,
                ArgumentInfo       = new ArgumentInfo()
            };

            objectPathInfo.ArgumentInfo.Arguments = new object[] { index };
            return(new ObjectPath(objectPathInfo, parent._ObjectPath, false /*isCollection*/, false /*isInvalidAfterRequest*/));
        }
Ejemplo n.º 6
0
        public static ObjectPath _CreateChildItemObjectPathUsingIndexer(ClientRequestContext context, ClientObject parent, JToken childItem)
        {
            var id = childItem[Constants.Id];

            if (Utility._IsNullOrUndefined(id))
            {
                id = childItem[Constants.IdPrivate];
            }

            ObjectPathInfo objectPathInfo = new ObjectPathInfo()
            {
                Id                 = context._NextId(),
                ObjectPathType     = ObjectPathType.Indexer,
                Name               = "",
                ParentObjectPathId = parent._ObjectPath.ObjectPathInfo.Id,
                ArgumentInfo       = new ArgumentInfo()
            };

            objectPathInfo.ArgumentInfo.Arguments = new object[] { id };
            return(new ObjectPath(objectPathInfo, parent._ObjectPath, false /*isCollection*/, false /*isInvalidAfterRequest*/));
        }