Пример #1
0
        internal void RegisterType(Type typeToRegister)
        {
#if DETAILED_DEBUG
            Trace.TraceInformation("Processing type " + typeToRegister.FullName);
#endif

            if (typeToRegister != null && typeof(IStateObject).IsAssignableFrom(typeToRegister) &&             //This is to make eliminating false cases faster
                (typeof(IDependentModel).IsAssignableFrom(typeToRegister) ||
                 typeof(IDependentViewModel).IsAssignableFrom(typeToRegister) ||
                 typeof(IViewModel).IsAssignableFrom(typeToRegister) ||
                 (typeof(IModel).IsAssignableFrom(typeToRegister))))
            {
                try
                {
                    if (!typeToRegister.IsAbstract && !typeToRegister.IsInterface)
                    {
                        if (typeof(NoInterception).IsAssignableFrom(typeToRegister))
                        {
                            TraceUtil.TraceInformation("Excluding type from interception " + typeToRegister.FullName);
                            non_interceptedTypes.Add(typeToRegister);
                        }
                        else
                        {
                            interceptedTypes.Add(typeToRegister);
                            if (!typeToRegister.IsGenericType)
                            {
                                InitializationHelpers.LoadTypeHierarchy(typeToRegister);
                            }
                        }
                        TypeCacheUtils.AddClientTypeRegistration(typeToRegister);
                    }
                }
                catch (Exception registerTypeException)
                {
                    Trace.TraceError("Bootstrapper::RegisterAllTypes problem while registering type " + typeToRegister.FullName + " Message " + registerTypeException.Message);
                }
            }
        }