public static Configuration AddEventListener(this Configuration config, string typeName)
        {
            var type = Type.GetType(typeName);
            var o    = Activator.CreateInstance(type);

            return(config.AddEventListener(o));
        }
 public static Configuration RegisterDependencyResolver(this Configuration cfg, INhDependencyResolver dependencyResolver)
 {
     Env.BytecodeProvider = new DiByteCodeProvider(dependencyResolver);
     cfg.AddEventListener(new AcrEventListener(dependencyResolver));
     return(cfg);
 }
        public static Configuration AddEventListener(this Configuration config, object o)
        {
            var type = o.GetType();

            if (type.IsImplementationOf <IAutoFlushEventListener>())
            {
                config.AddEventListener(ListenerType.Autoflush, o);
            }

            if (type.IsImplementationOf <IDeleteEventListener>())
            {
                config.AddEventListener(ListenerType.Delete, o);
            }

            if (type.IsImplementationOf <IDirtyCheckEventListener>())
            {
                config.AddEventListener(ListenerType.DirtyCheck, o);
            }

            if (type.IsImplementationOf <IEvictEventListener>())
            {
                config.AddEventListener(ListenerType.Evict, o);
            }

            if (type.IsImplementationOf <IFlushEntityEventListener>())
            {
                config.AddEventListener(ListenerType.FlushEntity, o);
            }

            if (type.IsImplementationOf <ILoadEventListener>())
            {
                config.AddEventListener(ListenerType.Load, o);
            }

            if (type.IsImplementationOf <ILockEventListener>())
            {
                config.AddEventListener(ListenerType.Lock, o);
            }

            if (type.IsImplementationOf <ISaveOrUpdateEventListener>())
            {
                config.AddEventListener(ListenerType.SaveUpdate, o);
            }

            if (type.IsImplementationOf <IPreUpdateEventListener>())
            {
                config.AddEventListener(ListenerType.PreUpdate, o);
            }

            if (type.IsImplementationOf <IPreLoadEventListener>())
            {
                config.AddEventListener(ListenerType.PreLoad, o);
            }

            if (type.IsImplementationOf <IPreDeleteEventListener>())
            {
                config.AddEventListener(ListenerType.PreDelete, o);
            }

            if (type.IsImplementationOf <IPreInsertEventListener>())
            {
                config.AddEventListener(ListenerType.PreInsert, o);
            }

            if (type.IsImplementationOf <IPostLoadEventListener>())
            {
                config.AddEventListener(ListenerType.PostLoad, o);
            }

            if (type.IsImplementationOf <IPostInsertEventListener>())
            {
                config.AddEventListener(ListenerType.PostInsert, o);
            }

            if (type.IsImplementationOf <IPostUpdateEventListener>())
            {
                config.AddEventListener(ListenerType.PostUpdate, o);
            }

            if (type.IsImplementationOf <IPostDeleteEventListener>())
            {
                config.AddEventListener(ListenerType.PostDelete, o);
            }
            return(config);
        }