示例#1
0
        private static ObjectLifeCycle GetObjectLifeCycle(string lifeCycle)
        {
            ObjectLifeCycle tempLifeCycle = ObjectLifeCycle.Singleton;

            if (string.IsNullOrEmpty(lifeCycle))
            {
                return(tempLifeCycle);
            }

            switch (lifeCycle.ToLower())
            {
            case "singleton":
                tempLifeCycle = ObjectLifeCycle.Singleton;
                break;

            case "new":
                tempLifeCycle = ObjectLifeCycle.New;
                break;
            }
            return(tempLifeCycle);
        }
        private void VerifyImplementation()
        {
            switch (ObjectLifeCycle)
            {
            case LifeCycle.Singleton:
                VerifySingleton();
                break;

            case LifeCycle.Transient:
                VerifyTransient();
                break;

            default:
                throw new NotSupportedException(string.Format("LifeCycle \"{0}\" not yet supported.", ObjectLifeCycle.ToString()));
            }
        }