Example #1
0
        /// <summary>DiscoverClassFiles
        /// <para></para>
        /// </summary>
        public Dictionary <string, TypeRefCollection> DiscoverClassFiles()
        {
            List <AopDetail> aopDetailLst;
            IManageTypeCollection <ManageTypeCollection>      manageTypeCollection;
            ILoasTypeDetail <LoadTypeDetail>                  loasTypeDetail;
            Dictionary <string, TypeRefCollection>            ClassTypeCollection  = null;
            Dictionary <string, List <InterfaceClassLinker> > interfaceClassLinker = null;

            try
            {
                aopDetailLst = null;
                //assemblyList = AppDomain.CurrentDomain.GetAssemblies().ToList<Assembly>();
                assemblyList         = LoadAssemblies();
                manageTypeCollection = new ManageTypeCollection();
                loasTypeDetail       = new LoadTypeDetail(assemblyList);
                ClassTypeCollection  = loasTypeDetail.BuildClassInformation(aopDetailLst);
                ICircularDependencyCheck _iCircularDependencyCheck = new CircularDependencyCheck(assemblyList);
                if (_iCircularDependencyCheck.LoadTypeForDependencyCheck() && ClassTypeCollection != null && ClassTypeCollection.Count() > 0)
                {
                    interfaceClassLinker = manageTypeCollection.MapInterfaceToClasses(ClassTypeCollection, aopDetailLst);
                    if (interfaceClassLinker != null)
                    {
                        container.SetInterfaceClassLinker(interfaceClassLinker);
                    }
                    manageTypeCollection.ManageConstructor(ClassTypeCollection);
                    if (container.MSSqlState)
                    {
                        TypeRefCollection ObjTypeRefCollection = manageTypeCollection.GetDbRefType();
                        ClassTypeCollection.Add("BottomhalfCore.DatabaseLayer.MsSql.Code.Db".ToLower(), ObjTypeRefCollection);
                        ClassTypeCollection.Add("BottomhalfCore.DatabaseLayer.Common.Code.IDb".ToLower(), ObjTypeRefCollection);
                    }
                    else if (container.MYSqlState)
                    {
                        TypeRefCollection ObjTypeRefCollection = manageTypeCollection.GetMySqlDbRefType();
                        ClassTypeCollection.Add("BottomhalfCore.DatabaseLayer.MySql.Code.Db".ToLower(), ObjTypeRefCollection);
                        ClassTypeCollection.Add("BottomhalfCore.DatabaseLayer.Common.Code.IDb".ToLower(), ObjTypeRefCollection);
                    }
                }
                return(ClassTypeCollection);
            }
            catch (BeanException _beanEx)
            {
                ClassTypeCollection  = null;
                interfaceClassLinker = null;
                assemblyList         = null;
                _beanEx.LocationTrack(this.GetType().FullName + "DiscoverClassFiles()");
                throw _beanEx;
            }
            catch (Exception ex)
            {
                BeanException ObjBeanException = new BeanException();
                ObjBeanException.LocationTrack(this.GetType().FullName + "DiscoverClassFiles()");
                ObjBeanException.SetMessage(ex.Message);
                throw ObjBeanException;
            }
        }
Example #2
0
        /// <summary>SetUpContextEnvironment
        /// <para></para>
        /// </summary>
        public Dictionary <string, TypeRefCollection> DiscoverDynamicLibrary(string LibName)
        {
            List <AopDetail> aopDetail = null;
            IManageTypeCollection <ManageTypeCollection>      manageTypeCollection;
            ILoasTypeDetail <LoadTypeDetail>                  loasTypeDetail;
            Dictionary <string, TypeRefCollection>            ClassTypeCollection  = null;
            Dictionary <string, List <InterfaceClassLinker> > interfaceClassLinker = null;
            IAssemblyHandler _iAssemblyHandler = new AssemblyHandler();

            assemblyList = _iAssemblyHandler.LoadNamedAssemblies(LibName, ref Bindir);
            ICircularDependencyCheck _iCircularDependencyCheck = new CircularDependencyCheck(assemblyList);

            if (_iCircularDependencyCheck.LoadTypeForDependencyCheck())
            {
                manageTypeCollection = new ManageTypeCollection();
                loasTypeDetail       = new LoadTypeDetail(assemblyList);
                ClassTypeCollection  = loasTypeDetail.BuildClassInformation(aopDetail);
                interfaceClassLinker = manageTypeCollection.MapInterfaceToClasses(ClassTypeCollection, aopDetail);
                manageTypeCollection.ManageConstructor(ClassTypeCollection);
            }
            return(ClassTypeCollection);
        }