예제 #1
0
        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));
 }
예제 #3
0
        public EFRepository(IEFUnitOfWork uow)
        {
            //if (uow == null) throw new ArgumentNullException("uow");

            UnitOfWork = uow;
            Context    = uow?.Context;
            _dbSet     = Context.Set <TEntity>();
        }
예제 #4
0
        public TRepository CreateRepository <TEntity, TRepository>(IEFUnitOfWork unitOfWork)
            where TRepository : IRepository <TEntity>
            where TEntity : class
        {
            TRepository repository = (TRepository)Activator.CreateInstance(typeof(TRepository), unitOfWork);

            return(repository);
        }
예제 #5
0
        public Repository(IEFUnitOfWork unitOfWork)
        {
            if (unitOfWork == null)
            {
                throw new ArgumentNullException("unitOfWork");
            }

            _context = unitOfWork.Context;
        }
예제 #6
0
 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>());
 }
예제 #7
0
        public EntityFrameworkRepository(IEFUnitOfWork unitOfWork)
        {
            if (unitOfWork == null)
            {
                throw new ArgumentNullException("UnitOfWork");
            }

            Context   = unitOfWork.Context;
            EntitySet = unitOfWork.Context.Set <TEntity>();
        }
예제 #8
0
        public EFRepository(IEFUnitOfWork unitOfWork)
        {
            if (unitOfWork == null)
            {
                throw new ArgumentNullException(nameof(unitOfWork));
            }

            this.unitOfWork = unitOfWork;
            this.dbSet      = unitOfWork.DBContext.Set <TEntity>();
        }
예제 #9
0
 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;
 }
예제 #11
0
        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;
        }
예제 #12
0
 public RoleService(IEFUnitOfWork eFUnitOfWork, IMapper mapper)
 {
     _eFUnitOfWork = eFUnitOfWork;
     _mapper       = mapper;
 }
 public ContactRepository(IEFUnitOfWork unitOfWork) : base(unitOfWork)
 {
 }
예제 #14
0
 public BankTransactionRepository(IEFUnitOfWork unitOfWork) : base(unitOfWork)
 {
 }
 public PositionService(IEFRepository <Position> positionRepository,
                        IEFUnitOfWork unitOfWork)
 {
     _positionRepository = positionRepository;
     _unitOfWork         = unitOfWork;
 }
예제 #16
0
 public DeudasEFController(IEFUnitOfWork unit)
 {
     _unit = unit;
 }
예제 #17
0
 public TalepUnitManager(IEFUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
 }
예제 #18
0
 public PageService(IEFUnitOfWork database)
 {
     Database = database;
 }
예제 #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="unitOfWork"></param>
 public EFBaseRepository(IEFUnitOfWork unitOfWork)
 {
     UnitOfWork = unitOfWork;
 }
예제 #20
0
 protected BaseService(IEFUnitOfWork unitOfWork)
 {
     UnitOfWork = unitOfWork;
 }
예제 #21
0
 public Sys_ModuleRepository(IEFUnitOfWork uow) : base(uow)
 {
 }
예제 #22
0
 public Sys_UserRepository(IEFUnitOfWork uow) : base(uow)
 {
     UnitOfWork = uow;
 }
예제 #23
0
 public EFProviderService(IEFUnitOfWork eFUnitOfWork, IMapper mapper)
 {
     _eFUnitOfWork = eFUnitOfWork;
     _mapper       = mapper;
 }
예제 #24
0
 protected BaseService(IEFUnitOfWork unitOfWork, IHttpContextAccessor httpContextAccessor)
 {
     UnitOfWork           = unitOfWork;
     _httpContextAccessor = httpContextAccessor;
 }
예제 #25
0
 public BaseRepository(IEFUnitOfWork uow)
 {
     UnitOfWork = uow;
 }
예제 #26
0
 public GenericRepository(IEFUnitOfWork unitOfWork) : base(unitOfWork)
 {
 }
예제 #27
0
 public ReadRepository(IEFUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
     _dbSet      = _unitOfWork.Context.Set <T> ();
 }
예제 #28
0
 public IRepositoryBase Create(IEFUnitOfWork uow)
 {
     return(new Repository(uow));
 }
예제 #29
0
 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;
        }