public UserRepository()
 {
     if (_dbcontext == null)
     {
         _dbcontext = new AzureDbContext();
         Database.SetInitializer <AzureDbContext>(null);
     }
 }
 public StudentEnrolledCoursesTests()
 {
     _services = new ServiceCollection();
     _services.AddDbContext <AzureDbContext>(options => options.UseSqlServer("Server=tcp:srosy-weber.database.windows.net,1433;Initial Catalog=LMS;Persist Security Info=False;User ID=srosy;Password=GaviSpe64!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"));
     _provider = _services.BuildServiceProvider();
     _context  = _provider.GetRequiredService(typeof(AzureDbContext)) as AzureDbContext;
     _db       = new DbService();
 }
Example #3
0
        public void AzureDbContextDiagram()
        {
            using (var myContext = new AzureDbContext())
            {
                var path = DotNet.GetExecutingDirectory() + "..\\..\\..";

                System.IO.File.WriteAllText(Path.Combine(path, "AzureDbContextDiagram.dgml"),
                                            myContext.AsDgml(),
                                            System.Text.Encoding.UTF8);
            }
        }
Example #4
0
        public AZObsController(AzureDbContext context)
        {
            _context = context;

            //create at least one item
            if (_context.AZObsItems.Count() == 0)
            {
                _context.AZObsItems.Add(new AZObsItem {
                    Name = "Item1"
                });
                _context.SaveChanges();
            }
        }
Example #5
0
 public static void Initialize(IServiceProvider serviceProvider)
 {
     using (var context = new AzureDbContext(
                serviceProvider.GetRequiredService <DbContextOptions <AzureDbContext> >()))
     {
         if (context.EmployeeDetail.Any())
         {
             return;
         }
         context.EmployeeDetail.AddRange(
             new EmployeeDetail
         {
             Name         = "Sorav Thakur",
             EmailAddress = "*****@*****.**"
         },
             new EmployeeDetail
         {
             Name         = "Demo",
             EmailAddress = "*****@*****.**"
         }
             );
         context.SaveChanges();
     }
 }
 public UsersController(AzureDbContext context)
 {
     _context = context;
 }
Example #7
0
 public PeopleController(AzureDbContext db)
 {
     this.db = db;
 }
Example #8
0
 public PeopleController(AzureDbContext azureDbContext)
 {
     _azureDbContext = azureDbContext;
 }
 public EmployeeDetailsController(AzureDbContext context)
 {
     _context = context;
 }
Example #10
0
 public AzureDbRepository(AzureDbContext context, IAzureUnitOfWork uow)
 {
     Context = context;
     Uow     = uow;
     DbSet   = context.Set <T>();
 }
Example #11
0
 public AzureUnitOfWork(AzureDbContext context)
 {
     _context = context;
     InitRepositories();
 }
 public UserManagerService(AzureDbContext context)
 {
     _context = context;
 }
Example #13
0
 public DashboardService(AzureDbContext context)
 {
     _context = context;
 }
Example #14
0
 public PeopleController(ILogger <PeopleController> logger, AzureDbContext azureDbContext)
 {
     _logger             = logger;
     this.azureDbContext = azureDbContext;
 }
Example #15
0
 public Repository(AzureDbContext context)
 {
     _context = context;
 }
 public PeopleController(AzureDbContext context)
 {
     _context = context;
 }
Example #17
0
 public PeopleController(AzureDbContext _context)
 {
     context = _context;
 }