/// <summary> /// Adds support for the specified function and data object to the capServer instance. /// </summary> /// <param name="capServer">The capServer instance.</param> /// <param name="function">The WITSML Store API function.</param> /// <param name="dataObject">The data object.</param> public static void Add(this Witsml131.CapServer capServer, Functions function, string dataObject) { if (capServer.Function == null) { capServer.Function = new List <Witsml131Schemas.Function>(); } var name = "WMLS_" + function.ToString(); var func = capServer.Function.FirstOrDefault(x => x.Name == name); if (func == null) { capServer.Function.Add(func = new Witsml131Schemas.Function() { Name = name, DataObject = new List <string>() }); } func.DataObject.Add(dataObject); }
/// <summary> /// Creates the capServers instance for a specific data schema version. /// </summary> /// <returns>The capServers instance.</returns> protected override Witsml131.CapServers CreateCapServer() { if (!Providers.Any()) { Logger.WarnFormat("No WITSML configuration providers loaded for data schema version {0}", DataSchemaVersion); return(null); } var capServer = new Witsml131.CapServer(); foreach (var config in Providers) { config.GetCapabilities(capServer); } // Sort each function by data object name capServer.Function.ForEach(f => f.DataObject = f.DataObject?.OrderBy(x => x).ToList()); capServer.ApiVers = "1.3.1"; capServer.SchemaVersion = DataSchemaVersion; capServer.Name = WitsmlSettings.DefaultServerName; capServer.Version = WitsmlSettings.OverrideServerVersion; capServer.Description = Settings.Default.DefaultServerDescription; capServer.Vendor = Settings.Default.DefaultVendorName; capServer.Contact = new Contact() { Name = Settings.Default.DefaultContactName, Email = Settings.Default.DefaultContactEmail, Phone = Settings.Default.DefaultContactPhone }; return(new Witsml131.CapServers() { CapServer = capServer, Version = capServer.ApiVers }); }