//public async Task UpsertAsync(Nethereum.RPC.Eth.DTOs.Transaction transaction,
        //    TransactionReceipt transactionReceipt,
        //    bool failedCreatingContract,
        //    HexBigInteger blockTimestamp,
        //    string address,
        //    string error = null,
        //    bool hasVmStack = false,
        //    string newContractAddress = null)
        //{
        //  var entity = AddressTransaction.CreateAddressTransaction(transaction,
        //      transactionReceipt,
        //      failedCreatingContract, blockTimestamp, null, null, false, newContractAddress);
        //  await InsertOrUpdate(entity);
        //}

        public async Task InsertOrUpdate(AddressTransaction addr)
        {
            using (var context = new BlockchainStoreContext())
            {
                //context.Entry(addr).State = string.IsNullOrEmpty(addr.Address) ?
                //                           EntityState.Added :
                //                           EntityState.Modified;
                try
                {
                    context.AddressTransactions.Add(addr);
                    await context.SaveChangesAsync();
                }
                catch (System.Exception)
                {
                }
            }
        }
Ejemplo n.º 2
0
 public async Task InsertOrUpdate(Block block)
 {
     using (var context = new BlockchainStoreContext())
     {
         //context.Entry(block).State = string.IsNullOrEmpty(block.BlockNumber) ?
         //                           EntityState.Added :
         //                           EntityState.Modified;
         try
         {
             context.Blocks.Add(block);
             await context.SaveChangesAsync();
         }
         catch (System.Exception)
         {
         }
     }
 }
        //public async Task UpsertAsync(string transactionHash, long logIndex,
        //    JObject log)
        //{
        //  var entity = TransactionLog.CreateTransactionLog(transactionHash,
        //      logIndex, log);

        //  await InsertOrUpdate(entity);
        //}

        public async Task InsertOrUpdate(TransactionLog trxlog)
        {
            using (var context = new BlockchainStoreContext())
            {
                //context.Entry(trxlog).State = trxlog.LogIndex == 0 ?
                //                           EntityState.Added :
                //                           EntityState.Modified;

                try
                {
                    context.TransactionLogs.Add(trxlog);
                    await context.SaveChangesAsync();
                }
                catch (System.Exception)
                {
                }
            }
        }
        public async Task AddTransactions()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            using (var context = new BlockchainStoreContext())
            {
                try
                {
                    context.Transactions.AddRange(TransactionList.Cast <Transaction>());
                    await context.SaveChangesAsync();

                    TransactionList = new List <dynamic>();
                    stopwatch.Stop();
                    System.Console.WriteLine("Transactionlarý VT ye yazma : " + stopwatch.Elapsed.TotalSeconds);
                }
                catch (System.Exception)
                {
                }
            }
        }