private static void SetupContainer() { ContainerBuilder builder = new ContainerBuilder(); builder.RegisterType <Logger>().As <ILogger>(); #region Modules //builder.RegisterModule<AutofacWebTypesModule>(); builder.RegisterModule <DataAccessRegistrationModule>(); builder.RegisterModule <ServicesRegistrationModule>(); #endregion builder.RegisterType <AutofacServiceProvider>() .As <SpSynthesis.Core.IServiceProvider>() .InstancePerLifetimeScope(); builder.RegisterAssemblyTypes(AppDomain.CurrentDomain.GetAssemblies()) .AssignableTo <BaseForm>() .SingleInstance() .OnActivated(e => ((BaseForm)e.Instance).Logger = e.Context.Resolve <ILogger>()); Container = builder.Build(); ServiceLocator.Initialize(() => { return(Container.Resolve <IServiceProvider>()); }); IEFUnitOfWork osf = ServiceLocator.Resolve <IEFUnitOfWork>(); }
public static IEFRepository <TDbContext, TEntity> GetRepository <TDbContext, TEntity>( [NotNull] this IEFUnitOfWork <TDbContext> unitOfWork) where TDbContext : DbContext where TEntity : class { return(new EFRepository <TDbContext, TEntity>(unitOfWork.DbContext)); }
public EFRepository(IEFUnitOfWork uow) { //if (uow == null) throw new ArgumentNullException("uow"); UnitOfWork = uow; Context = uow?.Context; _dbSet = Context.Set <TEntity>(); }
public TRepository CreateRepository <TEntity, TRepository>(IEFUnitOfWork unitOfWork) where TRepository : IRepository <TEntity> where TEntity : class { TRepository repository = (TRepository)Activator.CreateInstance(typeof(TRepository), unitOfWork); return(repository); }
public Repository(IEFUnitOfWork unitOfWork) { if (unitOfWork == null) { throw new ArgumentNullException("unitOfWork"); } _context = unitOfWork.Context; }
public static DbSet <TEntity> DbSet <TEntity>(this IEFUnitOfWork <DbContext> unitOfWork) where TEntity : class { if (unitOfWork is null) { throw new ArgumentNullException(nameof(unitOfWork)); } return(unitOfWork.DbContext.Set <TEntity>()); }
public EntityFrameworkRepository(IEFUnitOfWork unitOfWork) { if (unitOfWork == null) { throw new ArgumentNullException("UnitOfWork"); } Context = unitOfWork.Context; EntitySet = unitOfWork.Context.Set <TEntity>(); }
public EFRepository(IEFUnitOfWork unitOfWork) { if (unitOfWork == null) { throw new ArgumentNullException(nameof(unitOfWork)); } this.unitOfWork = unitOfWork; this.dbSet = unitOfWork.DBContext.Set <TEntity>(); }
public static IEFRepository <TDbContext, TEntity> GetRepository <TDbContext, TEntity>( this IEFUnitOfWork <TDbContext> unitOfWork) where TDbContext : DbContext where TEntity : class { if (unitOfWork is null) { throw new ArgumentNullException(nameof(unitOfWork)); } return(new EFRepository <TDbContext, TEntity>(unitOfWork.DbContext)); }
public MembershipService(IEFRepository <Users> userRepository, IEFRepository <Role> roleRepository, IEFRepository <UserRole> userRoleRepository, IEFRepository <Error> errorRepository, IEFUnitOfWork unitOfWork, IEncryptionService encryptionService) { _userRepository = userRepository; _roleRepository = roleRepository; _userRoleRepository = userRoleRepository; _encryptionService = encryptionService; }
public CityService( IEFRepository <City> cityRepository, IEFRepository <Location> locationRepository, IEFUnitOfWork unitOfWork) { Guard.WhenArgument(cityRepository, "CityService cityRepository") .IsNull() .Throw(); this.cityRepository = cityRepository; Guard.WhenArgument(locationRepository, "CityService locationRepository") .IsNull() .Throw(); this.locationRepository = locationRepository; Guard.WhenArgument(unitOfWork, "CityService unitOfWork") .IsNull() .Throw(); this.unitOfWork = unitOfWork; }
public RoleService(IEFUnitOfWork eFUnitOfWork, IMapper mapper) { _eFUnitOfWork = eFUnitOfWork; _mapper = mapper; }
public ContactRepository(IEFUnitOfWork unitOfWork) : base(unitOfWork) { }
public BankTransactionRepository(IEFUnitOfWork unitOfWork) : base(unitOfWork) { }
public PositionService(IEFRepository <Position> positionRepository, IEFUnitOfWork unitOfWork) { _positionRepository = positionRepository; _unitOfWork = unitOfWork; }
public DeudasEFController(IEFUnitOfWork unit) { _unit = unit; }
public TalepUnitManager(IEFUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; }
public PageService(IEFUnitOfWork database) { Database = database; }
/// <summary> /// /// </summary> /// <param name="unitOfWork"></param> public EFBaseRepository(IEFUnitOfWork unitOfWork) { UnitOfWork = unitOfWork; }
protected BaseService(IEFUnitOfWork unitOfWork) { UnitOfWork = unitOfWork; }
public Sys_ModuleRepository(IEFUnitOfWork uow) : base(uow) { }
public Sys_UserRepository(IEFUnitOfWork uow) : base(uow) { UnitOfWork = uow; }
public EFProviderService(IEFUnitOfWork eFUnitOfWork, IMapper mapper) { _eFUnitOfWork = eFUnitOfWork; _mapper = mapper; }
protected BaseService(IEFUnitOfWork unitOfWork, IHttpContextAccessor httpContextAccessor) { UnitOfWork = unitOfWork; _httpContextAccessor = httpContextAccessor; }
public BaseRepository(IEFUnitOfWork uow) { UnitOfWork = uow; }
public GenericRepository(IEFUnitOfWork unitOfWork) : base(unitOfWork) { }
public ReadRepository(IEFUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; _dbSet = _unitOfWork.Context.Set <T> (); }
public IRepositoryBase Create(IEFUnitOfWork uow) { return(new Repository(uow)); }
public CatalogService(IEFRepository <Catalog> catalogRepository, IEFUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; _catalogRepository = catalogRepository; }
public EFShopService(IEFUnitOfWork eFUnitOfWork, IMapper mapper) { _eFUnitOfWork = eFUnitOfWork; _mapper = mapper; }
public SaveChangesFilter(IEFUnitOfWork unitOfWork) { Guard.WhenArgument(unitOfWork, "Save changes unitOfWork").IsNull().Throw(); this.unitOfWork = unitOfWork; }