Example #1
0
        public Task <DatabaseService> Locate(DatabaseProtocol protocol)
        {
            // lower-invariant protocol & service name
            string protocolName = protocol.ToString().ToLowerInvariant();
            string serviceName  = $"_{protocolName}";

            // get name of service to resolve
            ServiceDnsName name = new ServiceDnsName
            {
                Domain      = ServiceDomain,
                ServiceName = serviceName,
                Protocol    = protocolName,
                DnsName     = string.IsNullOrEmpty(ServiceDomain)
                    ? serviceName.ToLowerInvariant()
                    : $"{serviceName.ToLowerInvariant()}._tcp.{ServiceDomain}"
            };

            // locate and return
            return(Locate(name, _ => ServiceLookup.SrvTxt(name, DbServiceFactory)));
        }
Example #2
0
 public Task <DatabaseService> Locate(string serviceName, DatabaseProtocol protocol)
 {
     return(Locate(serviceName, protocol.ToString()));
 }