protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);
            NotificationData.OnModelCreating(builder);
            InvoiceData.OnModelCreating(builder);
            PaymentData.OnModelCreating(builder);
            Data.UserStore.OnModelCreating(builder);
            APIKeyData.OnModelCreating(builder);
            AppData.OnModelCreating(builder);
            AddressInvoiceData.OnModelCreating(builder);
            PairingCodeData.OnModelCreating(builder);
            PendingInvoiceData.OnModelCreating(builder);
            Data.PairedSINData.OnModelCreating(builder);
            HistoricalAddressInvoiceData.OnModelCreating(builder);
            InvoiceEventData.OnModelCreating(builder);
            PaymentRequestData.OnModelCreating(builder);
            WalletTransactionData.OnModelCreating(builder);
            PullPaymentData.OnModelCreating(builder);
            PayoutData.OnModelCreating(builder);
            RefundData.OnModelCreating(builder);
            U2FDevice.OnModelCreating(builder);

            if (Database.IsSqlite() && !_designTime)
            {
                // SQLite does not have proper support for DateTimeOffset via Entity Framework Core, see the limitations
                // here: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/limitations#query-limitations
                // To work around this, when the Sqlite database provider is used, all model properties of type DateTimeOffset
                // use the DateTimeOffsetToBinaryConverter
                // Based on: https://github.com/aspnet/EntityFrameworkCore/issues/10784#issuecomment-415769754
                // This only supports millisecond precision, but should be sufficient for most use cases.
                foreach (var entityType in builder.Model.GetEntityTypes())
                {
                    var properties = entityType.ClrType.GetProperties().Where(p => p.PropertyType == typeof(DateTimeOffset));
                    foreach (var property in properties)
                    {
                        builder
                        .Entity(entityType.Name)
                        .Property(property.Name)
                        .HasConversion(new Microsoft.EntityFrameworkCore.Storage.ValueConversion.DateTimeOffsetToBinaryConverter());
                    }
                }
            }
        }
#pragma warning disable CS0618
        public static Payments.PaymentMethodId GetPaymentMethodId(this HistoricalAddressInvoiceData historicalAddressInvoiceData)
        {
            return(string.IsNullOrEmpty(historicalAddressInvoiceData.CryptoCode) ? new Payments.PaymentMethodId("BTC", Payments.PaymentTypes.BTCLike)
                                                    : Payments.PaymentMethodId.Parse(historicalAddressInvoiceData.CryptoCode));
        }
 public static HistoricalAddressInvoiceData SetAddress(this HistoricalAddressInvoiceData historicalAddressInvoiceData, string depositAddress, string cryptoCode)
 {
     historicalAddressInvoiceData.Address    = depositAddress + "#" + cryptoCode;
     historicalAddressInvoiceData.CryptoCode = cryptoCode;
     return(historicalAddressInvoiceData);
 }
示例#4
0
 public static HistoricalAddressInvoiceData SetAddress(this HistoricalAddressInvoiceData historicalAddressInvoiceData, string depositAddress, string bitcoinCode)
 {
     historicalAddressInvoiceData.Address     = depositAddress + "#" + bitcoinCode;
     historicalAddressInvoiceData.bitcoinCode = bitcoinCode;
     return(historicalAddressInvoiceData);
 }