1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

add x-platform support with netcore 2.0

This commit is contained in:
Kyle Spearrin
2017-07-31 16:58:27 -04:00
parent d6d9ceab87
commit 3880edfb79
12 changed files with 80 additions and 25 deletions

View File

@ -57,9 +57,8 @@ namespace Bit.Core.Utilities
public static DataTable ToArrayTVP<T>(this IEnumerable<T> values, string columnName)
{
var table = new DataTable();
var table = new DataTable($"{columnName}Array", "dbo");
table.Columns.Add(columnName, typeof(T));
table.SetTypeName($"[dbo].[{columnName}Array]");
if(values != null)
{
@ -74,8 +73,7 @@ namespace Bit.Core.Utilities
public static DataTable ToArrayTVP(this IEnumerable<SelectionReadOnly> values)
{
var table = new DataTable();
table.SetTypeName("[dbo].[SelectionReadOnlyArray]");
var table = new DataTable("SelectionReadOnlyArray", "dbo");
var idColumn = new DataColumn("Id", typeof(Guid));
table.Columns.Add(idColumn);

View File

@ -52,9 +52,14 @@ namespace Bit.Core.Utilities
{
services.AddSingleton<IMailService, RazorViewMailService>();
services.AddSingleton<IMailDeliveryService, SendGridMailDeliveryService>();
#if NET461
services.AddSingleton<IPushNotificationService, NotificationHubPushNotificationService>();
services.AddSingleton<IBlockIpService, AzureQueueBlockIpService>();
services.AddSingleton<IPushRegistrationService, NotificationHubPushRegistrationService>();
#else
services.AddSingleton<IPushNotificationService, NoopPushNotificationService>();
services.AddSingleton<IPushRegistrationService, NoopPushRegistrationService>();
#endif
services.AddSingleton<IBlockIpService, AzureQueueBlockIpService>();
services.AddSingleton<IAttachmentStorageService, AzureAttachmentStorageService>();
}
@ -154,6 +159,7 @@ namespace Bit.Core.Utilities
public static void AddCustomDataProtectionServices(
this IServiceCollection services, IHostingEnvironment env, GlobalSettings globalSettings)
{
#if NET461
if(!env.IsDevelopment())
{
var dataProtectionCert = CoreHelpers.GetCertificate(globalSettings.DataProtection.CertificateThumbprint);
@ -162,6 +168,7 @@ namespace Bit.Core.Utilities
.PersistKeysToAzureBlobStorage(storageAccount, "aspnet-dataprotection/keys.xml")
.ProtectKeysWithCertificate(dataProtectionCert);
}
#endif
}
public static GlobalSettings AddGlobalSettingsServices(this IServiceCollection services,