コード例 #1
0
        private Guid UpsertServiceEndpoint(ServiceEndpt serviceEndpt, string solutionName, RegistrationTypeEnum registrationType)
        {
            Guid Id = serviceEndpt?.Id ?? Guid.Empty;

            if (Id == Guid.Empty)
            {
                Id = pluginRepository.GetServiceEndpointId(serviceEndpt.Name);
                logWarning?.Invoke($"Extracted id using plugin assembly name {serviceEndpt.Name}");
            }

            var serviceEndpoint = new ServiceEndpoint()
            {
                Name              = serviceEndpt.Name,
                NamespaceAddress  = serviceEndpt.NamespaceAddress,
                ContractEnum      = serviceEndpt.Contract,
                Path              = serviceEndpt.Path,
                MessageFormatEnum = serviceEndpt.MessageFormat,
                AuthTypeEnum      = serviceEndpt.AuthType,
                SASKeyName        = serviceEndpt.SASKeyName,
                SASKey            = serviceEndpt.SASKey,
                SASToken          = serviceEndpt.SASToken,
                UserClaimEnum     = serviceEndpt.UserClaim,
                Description       = serviceEndpt.Description,
                Url       = serviceEndpt.Url,
                AuthValue = serviceEndpt.AuthValue,
            };

            if (!Id.Equals(Guid.Empty) && registrationType == RegistrationTypeEnum.Reset)
            {
                DeleteObjectWithDependencies(Id, ComponentType.ServiceEndpoint);
            }

            logVerbose?.Invoke($"Trying to upsert {serviceEndpt.Name} / {Id}");
            Id = ExecuteRequest(registrationType, Id, serviceEndpoint);

            AddComponentToSolution(Id, ComponentType.ServiceEndpoint, solutionName);

            return(Id);
        }