Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling DeprovisionAsync(string scopeName) will remove all scopes #1001

Open
bearyung opened this issue Apr 26, 2023 · 0 comments
Open

Calling DeprovisionAsync(string scopeName) will remove all scopes #1001

bearyung opened this issue Apr 26, 2023 · 0 comments

Comments

@bearyung
Copy link

I have multiple scopes under the same database and I have made a deprovision API to handle the DB clean up, however, when I passed the scope name to the DeprovisionAsync function, it will remove all my scopes, not only the scope I've specified.

Here's my deprovision API:

[HttpPost("deprovision")]
public async Task<JsonObject> DeprovisionScope([FromBody] ProvisionQueryDto inputProvisionQueryDto)
{
	var connectionString = _configuration.GetConnectionString("DefaultConnection");
	var sqlProvider = new SqlSyncChangeTrackingProvider(connectionString);
	var remoteOrchestrator = new RemoteOrchestrator(sqlProvider);

	//var resultScope = await remoteOrchestrator.GetScopeInfoAsync(inputProvisionQueryDto.ScopeName);

	// Deprovision everything
	var p = SyncProvision.ScopeInfo | SyncProvision.ScopeInfoClient |
			SyncProvision.StoredProcedures | SyncProvision.TrackingTable |
			SyncProvision.Triggers;

	var scopeName = (inputProvisionQueryDto?.ScopeName)?? "DefaultScope";

	// Deprovision everything
	var result = await remoteOrchestrator.DeprovisionAsync(scopeName, p);

	return new JsonObject()
	{
		{"resultCode", result ? "SUCCESS" : "FAILED"}
	};
}

public class ProvisionQueryDto
{
	[JsonPropertyName("scopeName")]
	public string? ScopeName { get; set; } = string.Empty;
}

Would like to know if I can specify which scope to clean, and not clean up all scopes when I call DeprovisionAsync. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant