VipRepository.cs 1.0 KB

12345678910111213141516171819202122232425262728
  1. using System.Collections.Generic;
  2. using Datory;
  3. using GxPress.Repository.Interface.Vip;
  4. using AutoMapper;
  5. using Microsoft.Extensions.Options;
  6. using GxPress.Common.AppOptions;
  7. using GxPress.Common.Tools;
  8. namespace GxPress.Repository.Implement.Vip
  9. {
  10. public class VipRepository : IVipRepository
  11. {
  12. private readonly Repository<Entity.Vip.Vip> _repository;
  13. private readonly IMapper _mapper;
  14. public VipRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
  15. {
  16. var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
  17. var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
  18. _repository = new Repository<Entity.Vip.Vip>(database);
  19. _mapper = mapper;
  20. }
  21. public IDatabase Database => _repository.Database;
  22. public string TableName => _repository.TableName;
  23. public List<TableColumn> TableColumns => _repository.TableColumns;
  24. }
  25. }