예제 #1
0
 void Load()
 {
     foreach (ServiceProvider item in ServiceProviderConfigSection.GetEntityProvider())
     {
         if (item.Disabled)
         {
             break;
         }
         if (!string.IsNullOrEmpty(item.AssemblyName))
         {
             string rootPath = string.Empty;
             try
             {
                 //if web application
                 rootPath = HttpRuntime.BinDirectory;
             }
             catch
             { //if remoting application
                 rootPath = string.Empty;
             }
             try
             {
                 string fileName = rootPath + item.AssemblyName + ".dll";
                 if (File.Exists(fileName))
                 {
                     Assembly assembly = Assembly.LoadFrom(fileName);
                     CollectionEntityMeta(assembly);
                 }
             }
             catch (Exception ex)
             {
             }
         }
     }
 }
예제 #2
0
        public void FreshService()
        {
            if (!IsLoadService)
            {
                CollectionService(Assembly.GetExecutingAssembly());

                foreach (ServiceProvider item in ServiceProviderConfigSection.GetServiceProvider())
                {
                    if (item.Disabled)
                    {
                        break;
                    }
                    if (!string.IsNullOrEmpty(item.AssemblyName))
                    {
                        string rootPath = string.Empty;
                        try
                        {
                            //if web application
                            rootPath = HttpRuntime.BinDirectory;
                        }
                        catch
                        { //if remoting application
                            rootPath = string.Empty;
                        }
                        try
                        {
                            string fileName = rootPath + item.AssemblyName + ".dll";
                            if (File.Exists(fileName))
                            {
                                Assembly assembly = Assembly.LoadFrom(fileName);
                                CollectionService(assembly);
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
                IsLoadService = true;
            }
        }