public IdentityUnitOfWork(PhotoAlbumContext context, IUserRepository userRepository, IRoleRepository roleRepository) { _context = context ?? throw new ArgumentNullException(nameof(context)); UserRepository = userRepository ?? throw new ArgumentNullException(nameof(userRepository)); RoleRepository = roleRepository ?? throw new ArgumentNullException(nameof(roleRepository)); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, PhotoAlbumContext photoAlbumContext) { photoAlbumContext.Database.Migrate(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Photo Album API V1"); }); app.UseRouting(); app.UseAuthorization(); app.UseCors(builder => { builder .SetIsOriginAllowed(_ => true) .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials(); }); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public UnitOfWork(PhotoAlbumContext context) { _context = context; Users = new UserRepository(_context); Albums = new AlbumRepository(_context); Images = new ImageRepository(_context); }
public UnitOfWork(PhotoAlbumContext context, IPhotoRepository photoRepository, IClientProfilesRepository clientProfilesRepository, ILikeRepository likeRepository) { _context = context ?? throw new ArgumentNullException(nameof(context)); ClientProfilesRepository = clientProfilesRepository ?? throw new ArgumentNullException(nameof(clientProfilesRepository)); PhotoRepository = photoRepository ?? throw new ArgumentNullException(nameof(photoRepository)); LikeRepository = likeRepository ?? throw new ArgumentNullException(nameof(likeRepository)); }
public JsonResult <User> Get() { PhotoAlbumContext context = new PhotoAlbumContext("PhotoAlbumDb"); foreach (var i in context.Users) { Console.WriteLine("userId = " + i.Id + " name = " + i.Name); } return(Json(context.Users.First())); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Database.SetInitializer(new DropCreateDatabaseIfModelChanges <PhotoAlbumContext>()); using (var context = new PhotoAlbumContext("PhotoAlbum1")) { context.Database.Initialize(force: true); } }
public TagsController(PhotoAlbumContext context) { _context = context; }
public RoleRepository(PhotoAlbumContext context) : base(context) { _roleManager = new AppRoleManager(new CustomRoleStore(context)); }
public TagRepository(PhotoAlbumContext dbContext) : base(dbContext) { }
/// <summary>Initializes a new instance of the <see cref="T:DAL.Repositories.LikeRepository"/> class.</summary> /// <param name="context">The context.</param> public LikeRepository(PhotoAlbumContext context) { db = context; }
public PhotoRepository(PhotoAlbumContext context) : base(context) { }
public ClientProfileRepository(PhotoAlbumContext context) : base(context) { }
public EFRepository(PhotoAlbumContext context) { this.context = context; dbSet = context.Set <TEntity>(); }
public BaseRepository(PhotoAlbumContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); _dbSet = _context.Set <T>(); }
/// <summary>Initializes a new instance of the <see cref="T:DAL.Repositories.UnitOfWork"/> class.</summary> /// <param name="connectionString">The connection string.</param> public UnitOfWork(string connectionString) { db = new PhotoAlbumContext(connectionString); }
/// <summary>Initializes a new instance of the <see cref="T:DAL.Repositories.TagRepository"/> class.</summary> /// <param name="context">The context.</param> public TagRepository(PhotoAlbumContext context) { db = context; }
public CustomUserStore(PhotoAlbumContext context) : base(context) { }
public CustomRoleStore(PhotoAlbumContext context) : base(context) { }
public GetPhotoByIdFunction(PhotoAlbumContext context) { _context = context; }
public UserRepository(PhotoAlbumContext context) : base(context) { _userManager = new AppUserManager(new UserStore <ApplicationUser, ApplicationRole, int, CustomUserLogin, CustomUserRole, CustomUserClaim>(context)); }
/// <summary>Initializes a new instance of the <see cref="T:DAL.Repositories.ProfileRepository"/> class.</summary> /// <param name="context">The context.</param> public ProfileRepository(PhotoAlbumContext context) { db = context; }
public PhotosController(PhotoAlbumContext context, IConfiguration configuration) { _context = context; _blobStorageConnectionString = configuration.GetConnectionString("BlobStorage"); }