public GeneralRepository(DevnotContext context, IEncryption encryption, IOptions <ElasticConnectionSettings> elasticConfig, IElasticSearchService <AuditLogModel> elasticAuditLogService)
 {
     _context                = context;
     _entities               = context.Set <T>();
     _encryption             = encryption;
     _elasticConfig          = elasticConfig;
     _elasticAuditLogService = elasticAuditLogService;
 }
Пример #2
0
 public ProductService(
     IRepository <Product> productRepository,
     IRepository <ExchangeType> exchangeTypeRepository,
     IMapper mapper,
     DevnotContext devnotContext,
     IRedisCacheService redisCacheManager,
     IRabbitMQService rabbitMQService
     )
 {
     _productRepository      = productRepository;
     _exchangeTypeRepository = exchangeTypeRepository;
     _mapper            = mapper;
     _devnotContext     = devnotContext;
     _redisCacheManager = redisCacheManager;
     _rabbitMQService   = rabbitMQService;
 }
 public virtual T DecryptEntityFields(T entity, DevnotContext _dbcontext)
 {
     MetadataTypeAttribute[] metadataTypes = entity.GetType().GetCustomAttributes(true).OfType <MetadataTypeAttribute>().ToArray();
     foreach (MetadataTypeAttribute metadata in metadataTypes)
     {
         System.Reflection.PropertyInfo[] properties = metadata.MetadataClassType.GetProperties();
         //Metadata atanmış entity'nin tüm propertyleri tek tek alınır.
         foreach (System.Reflection.PropertyInfo pi in properties)
         {
             //Eğer ilgili property ait CryptoData flag'i var ise ilgili deger Decrypt edilir.
             if (Attribute.IsDefined(pi, typeof(DAL.PartialEntites.CryptoData)))
             {
                 _dbcontext.Entry(entity).Property(pi.Name).CurrentValue = _encryption.DecryptText(_dbcontext.Entry(entity).Property(pi.Name).CurrentValue.ToString());
             }
         }
     }
     return(entity);
 }