mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Add DatabaseHandler to enable Delete Database operations (#2041)
This commit is contained in:
@@ -36,6 +36,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
|
||||
this.objectTypeHandlers.Add(new AppRoleHandler(ConnectionService.Instance));
|
||||
this.objectTypeHandlers.Add(new DatabaseRoleHandler(ConnectionService.Instance));
|
||||
this.objectTypeHandlers.Add(new ServerRoleHandler(ConnectionService.Instance));
|
||||
this.objectTypeHandlers.Add(new DatabaseHandler(ConnectionService.Instance));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.ObjectManagement.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
|
||||
{
|
||||
/// <summary>
|
||||
/// Database object type handler
|
||||
/// </summary>
|
||||
public class DatabaseHandler : ObjectTypeHandler<DatabaseInfo, DatabaseViewContext>
|
||||
{
|
||||
public DatabaseHandler(ConnectionService connectionService) : base(connectionService)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool CanHandleType(SqlObjectType objectType)
|
||||
{
|
||||
return objectType == SqlObjectType.Database;
|
||||
}
|
||||
|
||||
public override Task<InitializeViewResult> InitializeObjectView(InitializeViewRequestParams requestParams)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override Task Save(DatabaseViewContext context, DatabaseInfo obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override Task<string> Script(DatabaseViewContext context, DatabaseInfo obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for storing various properties needed for Saving & Scripting a database
|
||||
/// </summary>
|
||||
public class DatabaseInfo : SqlObject
|
||||
{
|
||||
public string? Owner { get; set; }
|
||||
public string? CollationName { get; set; }
|
||||
public string? RecoveryModel { get; set; }
|
||||
public string? CompatibilityLevel { get; set; }
|
||||
public string? ContainmentType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlTools.ServiceLayer.ObjectManagement.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
|
||||
{
|
||||
public class DatabaseViewContext : SqlObjectViewContext
|
||||
{
|
||||
public DatabaseViewContext(InitializeViewRequestParams parameters) : base(parameters)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectManagement
|
||||
[EnumMember(Value = "User")]
|
||||
User,
|
||||
[EnumMember(Value = "View")]
|
||||
View
|
||||
View,
|
||||
[EnumMember(Value = "Database")]
|
||||
Database
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user