예제 #1
0
        static void Main(string[] args)
        {
            //using (var dbContext = new IdentityDbContext(CreateDbContextOptions<IdentityDbContext>()))
            //{
            //    dbContext.Users.Add(new IdentityUser(Guid.NewGuid(), "john", "123"));
            //    dbContext.Users.Add(new IdentityUser(Guid.NewGuid(), "neo", "123"));
            //    dbContext.SaveChanges();
            //}

            using (var dbContext = new IdentityDbContext(CreateDbContextOptions <IdentityDbContext>()))
            {
                foreach (var user in dbContext.Users.ToList())
                {
                    Console.WriteLine(user);
                }
            }

            using (var dbContext = new QaDbContext(CreateDbContextOptions <QaDbContext>()))
            {
                foreach (var user in dbContext.Users.ToList())
                {
                    Console.WriteLine(user);
                }

                foreach (var question in dbContext.Questions.ToList())
                {
                    Console.WriteLine(question);
                }
            }

            Console.ReadLine();
        }
예제 #2
0
 public UserController(QaDbContext db)
 {
     _db = db;
 }