示例#1
0
 /// <summary>
 /// Specifies the type of object structure to search.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="objectStructureName">The name of the Maximo object structure.</param>
 /// <returns> A <see cref="MaximoResourceSet" /> instance. </returns>
 public static MaximoResourceSearch ForResourceSearch(this IMaximoJsonClient client, string objectStructureName)
 {
     return(new MaximoResourceSearch
     {
         Client = client,
         ObjectStructureName = objectStructureName
     });
 }
示例#2
0
 /// <summary>
 /// Specifies the type of resource to access.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="objectStructureName">The name of the Maximo object structure.</param>
 /// <param name="id">The unique Id of the specific resource.</param>
 /// <returns>A <see cref="MaximoResourceSet"/> instance.</returns>
 public static MaximoResource ForResource(this IMaximoJsonClient client, string objectStructureName, string id)
 {
     return(new MaximoResource
     {
         Client = client,
         ObjectStructureName = objectStructureName,
         Id = id
     });
 }
示例#3
0
        /// <summary>
        /// Attempts to retrieve an existing client or create a new client with the assigned <paramref name="name"/>.
        /// </summary>
        /// <param name="name">The name of the connection to create.</param>
        /// <param name="client">The configured <see cref="MaximoJsonClient"/> client.</param>
        /// <returns><see langword="true"/> if a connection with the assigned <paramref name="name"/> was created, <see langword="false"/> otherwise.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="client"/> is <see langword="null"/></exception>
        public bool TryGetClient(string name, out IMaximoJsonClient client)
        {
            try
            {
                client = GetClient(name);
                return(true);
            }
            catch (Exception ex)
            {
                _logger.LogError("Failed to retrieve client \"{Name}\". Reason: {@Exception}", name, ex);

                client = null;
                return(false);
            }
        }