Пример #1
0
        public async Task <EntityIdentity?> RemoveLaunchProfileAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, string profileName, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();

            await _launchSettingsProvider.RemoveProfileAsync(profileName);

            if (_launchSettingsProvider.CurrentSnapshot is IVersionedLaunchSettings versionedLaunchSettings)
            {
                queryExecutionContext.ReportUpdatedDataVersion(_launchSettingsTracker.VersionKey, versionedLaunchSettings.Version);
            }

            return(CreateLaunchProfileId(parent, profileName));
        }
        protected override async Task ExecuteAsync(ILaunchSettingsProvider launchSettingsProvider, CancellationToken cancellationToken)
        {
            ILaunchSettings?launchSettings = await launchSettingsProvider.WaitForFirstSnapshot(Timeout.Infinite).WithCancellation(cancellationToken);

            Assumes.NotNull(launchSettings);

            ILaunchProfile?existingProfile = launchSettings.Profiles.FirstOrDefault(p => StringComparers.LaunchProfileNames.Equals(p.Name, _executableStep.CurrentProfileName));

            if (existingProfile is not null)
            {
                var writableProfile = new WritableLaunchProfile(existingProfile);
                writableProfile.Name = _executableStep.NewProfileName;

                await launchSettingsProvider.RemoveProfileAsync(_executableStep.CurrentProfileName);

                await launchSettingsProvider.AddOrUpdateProfileAsync(writableProfile.ToLaunchProfile(), addToFront : false);
            }
        }
 protected override Task ExecuteAsync(ILaunchSettingsProvider launchSettingsProvider, CancellationToken cancellationToken)
 {
     return(launchSettingsProvider.RemoveProfileAsync(_executableStep.ProfileName));
 }
        public Task RemoveLaunchProfileAsync(string profileName, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();

            return(_launchSettingsProvider.RemoveProfileAsync(profileName));
        }