コード例 #1
0
        public Processor(Context context, ConfigSection config)
        {
            Context  = context;
            _filters = new List <Module>();

            foreach (var moduleElement in config.Modules)
            {
                if (moduleElement.Attributes().Any(a => a.Name == ModuleNameAttribute))
                {
                    var name    = moduleElement.Attribute(ModuleNameAttribute).Value;
                    var factory = FilterFactories.Single(f => f.Name == name);
                    var filter  = factory.Create(context, moduleElement);
                    _filters.Add(filter);
                }
                else
                {
                    Context.Logger.Warning("Module element without name attribute.");
                }
            }
        }
コード例 #2
0
 public AuditService()
 {
     _allProperties = new Lazy <IDictionary <Guid, IAuditProperty> >(() =>
                                                                     EventKinds.SelectMany(k => k.Properties).Distinct().ToDictionary(p => p.ID));
     _allEventKinds = new Lazy <IDictionary <Guid, AuditEventKind> >(() =>
                                                                     EventKinds.ToDictionary(k => k.ID));
     _filterFactories = new Lazy <ILookup <string, IAuditEventFilterFactory <TDomain> > >(() =>
                                                                                          FilterFactories.EmptyIfNull().ToLookup(f => f.Id.ToString(), StringComparer.InvariantCultureIgnoreCase));
 }