Ejemplo n.º 1
0
        public SiteMembership()
        {
            String logMethodName = ".ctor()";

            _log.Info(logMethodName + " - Creating new static SiteMembership Instance");
            _log.Debug(logMethodName + " - Begin Constructor");

            try
            {
                _log.Debug(logMethodName + " - Retrieving IntegrationLoader.CurrentSecurityAdapter");
                _adapter = IntegrationLoader.CurrentSecurityAdapter;
            }
            catch (Exception ex)
            {
                String message = logMethodName + " - Unable to load security adapter, context init failure";
                _log.Fatal(message, ex);

                throw new WtfException(message, ex);
            }

            try
            {
                _log.Debug(logMethodName + " - Retrieving IntegrationLoader.CurrentContextDataProvider");
                _provider = IntegrationLoader.CurrentContextDataProvider;
            }
            catch (Exception ex)
            {
                String message = logMethodName + "Unable to load context data provider, context init failure";
                _log.Fatal(message, ex);

                throw new WtfException(message, ex);
            }

            _log.Debug(logMethodName + " - End Constructor");
        }
Ejemplo n.º 2
0
 protected void Application_Start()
 {
     try
     {
         // Code that runs on application startup
         log4net.Config.XmlConfigurator.Configure();
         _log.InfoFormat("SAL Host Startup");
         RegisterRoutes(RouteTable.Routes);
         //LoginToAvectra();
     }
     catch (Exception ex)
     {
         _log.Fatal("Application was not able to start correctly!", ex);
     }
 }
Ejemplo n.º 3
0
        private void Init()
        {
            String logMethodName = ".Init() - ";

            _log.Debug(logMethodName + "Begin Method");

            //We only need the context data provider as SiteMember is responsible for institutions.
            //MemberAccount handles all user-level security adapter fuctions.
            try
            {
                _log.Debug(logMethodName + "Retrieving IntegrationLoader.CurrentContextDataProvider");
                _provider = IntegrationLoader.CurrentContextDataProvider;
            }
            catch (Exception ex)
            {
                String message = logMethodName + "Unable to load context data provider, SiteMember init failed";

                _log.Fatal(message, ex);

                throw new WtfException(message, ex);
            }

            _log.Debug(logMethodName + "End Method");
        }
Ejemplo n.º 4
0
        public static T LoadDependency <T>(string name)
        {
            string logMethodName = ".LoadDependency<T>(string name) - ";
            string strType       = "";

            lock (_lock)
            {
                //Is it already loaded?
                if (_dictDependencies.ContainsKey(name))
                {
                    object oDependency = _dictDependencies[name];
                    if (oDependency is T)
                    {
                        return((T)oDependency);
                    }
                    else
                    {
                        String message = logMethodName + "type " + strType + " does not implement " + typeof(T).FullName;
                        _log.Fatal(message);

                        throw new WtfException(message);
                    }
                }

                // Is Name in Config?
                foreach (DependencyConfigurationElement elem in _contextConfig.Dependencies)
                {
                    if (elem.Name == name)
                    {
                        strType = elem.Class;
                        break;
                    }
                }

                if (strType == "")
                {
                    string message = logMethodName + "No dependency configured for name: " + name;
                    _log.Fatal(message);
                    throw new WtfException(message);
                }

                Type tDependency;
                // Next load type
                try
                {
                    _log.Debug(logMethodName + "Loading dependecy type: " + strType);

                    tDependency = Type.GetType(strType);
                }
                catch (Exception ex)
                {
                    String message = logMethodName + "Unable to load dependency type: " + strType;
                    _log.Fatal(message, ex);

                    throw new WtfException(message, ex);
                }

                if (tDependency == null)
                {
                    String message = logMethodName + "Unable to load dependency type: " + strType;
                    _log.Fatal(message);

                    throw new WtfException(message);
                }

                // Finally create instances.
                try
                {
                    _log.Debug(logMethodName + "Creating Instance for " + name + ", " + strType);
                    object oDependency = Activator.CreateInstance(tDependency);
                    if (oDependency is T)
                    {
                        _dictDependencies.Add(name, (T)oDependency);
                    }
                    else
                    {
                        String message = logMethodName + "type " + strType + " does not implement " + typeof(T).FullName;
                        _log.Fatal(message);

                        throw new WtfException(message);
                    }
                }
                catch (Exception ex)
                {
                    String message = logMethodName + "Unable to create an instance for " + name + ", " + strType;
                    _log.Fatal(message, ex);

                    throw new WtfException(message, ex);
                }
                // COV 10334 - This should be inside the lock block.
                return((T)_dictDependencies[name]);
            }
        }