예제 #1
0
        //extension
        public static void SeedAccounts(this FinancialAppContext context)
        {
            context.Add(new Account
            {
                Amount         = 500,
                ConversionRate = 0.25,
                Currency       = "USD",
                Name           = "Account 1"
            });

            context.Add(new Account
            {
                Amount         = 560,
                ConversionRate = 0.25,
                Currency       = "USD",
                Name           = "Account 2"
            });

            context.Add(new Account
            {
                Amount         = 450,
                ConversionRate = 1,
                Currency       = "HNL",
                Name           = "Account 3"
            });
            context.SaveChanges();
        }
예제 #2
0
        public static FinancialAppContext GetInMemoryContext()
        {
            var connection = new SqliteConnection("DataSource=:memory:");

            connection.Open();

            var dbContextOptions = new DbContextOptionsBuilder <FinancialAppContext>()
                                   .UseSqlite(connection)
                                   .Options;

            var context = new FinancialAppContext(dbContextOptions);

            context.Database.EnsureCreated();
            return(context);
        }
예제 #3
0
 protected BaseRepository(FinancialAppContext context)
 {
     Context = context;
 }
예제 #4
0
 public AccountRepository(FinancialAppContext financialAppContext)
 {
     _financialAppContext = financialAppContext;
 }
 public TransactionRepository(FinancialAppContext context)
     : base(context)
 {
 }
예제 #6
0
 public AccountRepository(FinancialAppContext context) : base(context)
 {
 }
예제 #7
0
 public TransactionRepository(FinancialAppContext financialAppContext)
 {
     _financialAppContext = financialAppContext;
 }
 public TransactionRepository(FinancialAppContext context)
 {
     this._context = context;
 }
 public AccountRepository(FinancialAppContext context)
 {
     this._context = context;
 }