Exemplo n.º 1
0
        /// <summary>
        /// 日志构造器
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static IIocBuilder UseLogProvider(this IIocBuilder builder, MvxLogProviderType type = MvxLogProviderType.Console)
        {
            Func <ITcLogProvider> logProviderCreator;

            switch (type)
            {
            case MvxLogProviderType.Console:
                logProviderCreator = () => new ConsoleLogProvider();
                break;

            case MvxLogProviderType.EntLib:
                logProviderCreator = () => new EntLibLogProvider();
                break;

            case MvxLogProviderType.Log4Net:
                logProviderCreator = () => new Log4NetLogProvider();
                break;

            case MvxLogProviderType.Loupe:
                logProviderCreator = () => new LoupeLogProvider();
                break;

            case MvxLogProviderType.NLog:
                logProviderCreator = () => new NLogLogProvider();
                break;

            case MvxLogProviderType.Serilog:
                logProviderCreator = () => new SerilogLogProvider();
                break;

            default:
                logProviderCreator = null;
                break;
            }
            if (logProviderCreator != null)
            {
                builder.RegisterSingleton <ITcLogProvider>(logProviderCreator);
            }
            return(builder);
        }
Exemplo n.º 2
0
 public static IIocBuilder UseApplication <TApplication>(this IIocBuilder builder) where TApplication : ApplicationBase
 {
     builder.RegisterSingleton <ApplicationBase, TApplication>();
     return(builder);
 }
Exemplo n.º 3
0
 public static IIocBuilder RegisterSetup <TIiSetup>(this IIocBuilder builder) where TIiSetup : AppSetupBase
 {
     builder.RegisterSingleton <AppSetupBase, TIiSetup>();
     return(builder);
 }