Nancy 过滤加载dll
protected override void ConfigureApplicationContainer(TinyIoCContainer container) { List<Func<Assembly, bool>> IgnoredAssemblies = DefaultNancyBootstrapper.DefaultAutoRegisterIgnoredAssemblies.ToList(); // IgnoredAssemblies.Add((asy) => asy.FullName.StartsWith("Seagull", StringComparison.InvariantCulture)); //var expression = LinqExtensions.True<Assembly>(); //var query = from a in AppDomain.CurrentDomain.GetAssemblies() // where a.FullName.StartsWith("Seagull") // select a; //List<Func<Assembly, bool>> ignoredAssemblies = new List<Func<Assembly, bool>>(); //foreach (var item in query) { // ignoredAssemblies.Add((asys) => { return asys == item; }); //} //Assembly assembly = typeof(NancyEngine).Assembly; ////var list = (from a in AppDomain.CurrentDomain.GetAssemblies() //// where !ignoredAssemblies.Any((Func<Assembly, bool> ia) => ia(a)) //// select a).ToList(); ////container.AutoRegister(from a in AppDomain.CurrentDomain.GetAssemblies() //// where !ignoredAssemblies.Any((Func<Assembly, bool> ia) => ia(a)) //// select a, DuplicateImplementationActions.RegisterMultiple, (Type t) => t.Assembly != assembly); this.AutoRegister(container, IgnoredAssemblies); } private void AutoRegister(TinyIoCContainer container, IEnumerable<Func<Assembly, bool>> ignoredAssemblies) { Assembly assembly = typeof(NancyEngine).Assembly; container.AutoRegister(from a in AppDomain.CurrentDomain.GetAssemblies() where !ignoredAssemblies.Any((Func<Assembly, bool> ia) => ia(a)) && a.FullName.StartsWith("Leadyo") select a, DuplicateImplementationActions.RegisterMultiple, (Type t) => t.Assembly != assembly); }