Ejemplo n.º 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            var serviceScope = serviceProvider.CreateScope();

            using (TransferDBContext context = serviceScope.ServiceProvider.GetRequiredService <TransferDBContext>())
            {
                try
                {
                    context.Database.Migrate();
                }
                catch (Exception ex)
                {
                }

                if (!context.TransferLogs.Any())
                {
                    context.TransferLogs.Add(new TransferLog
                    {
                        FromAccount    = 1,
                        ToAccount      = 2,
                        TrasnferAmount = 100
                    });

                    context.SaveChanges();
                }
            }
        }
Ejemplo n.º 2
0
 public TransferRepository(TransferDBContext context)
 {
     _ctx = context;
 }
 public TransferRepository(TransferDBContext transferDBContext)
 {
     this.transferDBContext = transferDBContext;
 }
Ejemplo n.º 4
0
 public TransferRepository(TransferDBContext ctx)
 {
     _ctx = ctx;
 }
 public TransfeRepository(TransferDBContext transferDBContext)
 {
     _transferDBContext = transferDBContext;
 }