public void RegisterCompilers(IEnumerable <KeyValuePair <MemberInfo, Func <MemberInfo, T, T[], T> > > compilerDefinitions, ConflictHandlingMethod conflictHandlingMethod) { ArgumentValidator.EnsureArgumentNotNull(compilerDefinitions, "compilerDefinitions"); this.EnsureNotLocked(); var newItems = new MemberCompilerCollection(); foreach (var item in compilerDefinitions) { newItems.Add(new MemberCompilerRegistration(GetCanonicalMember(item.Key), item.Value)); } UpdateRegistry(newItems, conflictHandlingMethod); }
public void RegisterCompilers(Type compilerContainer, ConflictHandlingMethod conflictHandlingMethod) { ArgumentValidator.EnsureArgumentNotNull(compilerContainer, "compilerContainer"); this.EnsureNotLocked(); if (compilerContainer.IsGenericType) { throw new InvalidOperationException(string.Format( Strings.ExTypeXShouldNotBeGeneric, compilerContainer.GetFullName(true))); } var compilersToRegister = new MemberCompilerCollection(); var compilerMethods = compilerContainer .GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly) .Where(method => method.IsDefined(typeof(CompilerAttribute), false) && !method.IsGenericMethod); foreach (var compiler in compilerMethods) { compilersToRegister.Add(ProcessCompiler(compiler)); } UpdateRegistry(compilersToRegister, conflictHandlingMethod); }