コード例 #1
0
        private void HandleCircularDependency(int from)
        {
            if (OnCircularDependency == Reaction.Ignore)
            {
                return;
            }

            var builder = new StringBuilder();

            builder.Append("Type: " + _stack[from].Object.GetType() + ". Property: " + _stack[from].PropertyName);
            for (int i = from + 1; i < _stack.Count; ++i)
            {
                builder.AppendLine(" -> ");
                builder.Append("Type: " + _stack[i].Object.GetType() + ". Property: " + _stack[i].PropertyName);
            }

            switch (OnCircularDependency)
            {
            case Reaction.LogWarning:
                DILog.LogWarning("Circular dependency found: " + builder.ToString());
                break;

            case Reaction.LogError:
                DILog.LogError("Circular dependency found: " + builder.ToString());
                break;

            case Reaction.ThrowException:
                throw new CircularDependencyException(builder.ToString());
            }
        }
コード例 #2
0
        private void HandleLifetimeError(string message)
        {
            switch (OnLifetimeError)
            {
            case Reaction.LogWarning:
                DILog.LogWarning(message);
                break;

            case Reaction.LogError:
                DILog.LogError(message);
                break;

            case Reaction.ThrowException:
                throw new WrongLifetimeException(message);
            }
        }