Exemplo n.º 1
0
 public HttpCommunicationMethod(
     IDefaultSerializerProvider defaultSerializerProvider,
     ISerializerProvider serializerProvider)
 {
     _defaultSerializer  = defaultSerializerProvider.DefaultSerializer;
     _serializerProvider = serializerProvider;
 }
Exemplo n.º 2
0
 public LoginService(string userDataPath, ICurrentUser currentUser, ISerializerProvider serializerProvider, IErrorService errorService)
 {
     m_userDataPath       = userDataPath;
     m_currentUser        = currentUser;
     m_serializerProvider = serializerProvider;
     m_errorService       = errorService;
 }
Exemplo n.º 3
0
 public FilePersistenceMethod(
     IDefaultSerializerProvider defaultSerializerProvider,
     ISerializerProvider serializerProvider)
 {
     _defaultSerializer  = defaultSerializerProvider.DefaultSerializer;
     _serializerProvider = serializerProvider;
 }
 public JToken Serialize(
     IModelMember dataSource,
     ISerializerProvider provider,
     IElementSerializer elementSerializer)
 {
     var attrDataSource = dataSource as IModelAttributeMember;
     return new JProperty(attrDataSource.Name, attrDataSource.Value);
 }
Exemplo n.º 5
0
 /// <summary>Gets serializer mapped to the key. If not found, will return fallback serializer.</summary>
 /// <typeparam name="TKey">Type of the serializer key.</typeparam>
 /// <typeparam name="TSerializer">Type of the serializer.</typeparam>
 /// <param name="provider">Provider to get serializer from.</param>
 /// <param name="key">Key to get the serializer for.</param>
 /// <returns>Found serializer; if not found, then fallback serializer</returns>
 public static TSerializer GetSerializer <TKey, TSerializer>(this ISerializerProvider <TKey, TSerializer> provider, TKey key)
 {
     if (provider.TryFindSerializer(key, out TSerializer result))
     {
         return(result);
     }
     return(provider.FallbackSerializer);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new <see cref="ODataFunctionProcessor"/>
 /// </summary>
 /// <param name="serviceProvider">The current <see cref="IServiceProvider"/></param>
 /// <param name="loggerFactory">The service used to create <see cref="ILogger"/>s</param>
 /// <param name="context">The current <see cref="IWorkflowRuntimeContext"/></param>
 /// <param name="activityProcessorFactory">The service used to create <see cref="IWorkflowActivityProcessor"/>s</param>
 /// <param name="httpClientFactory">The service used to create <see cref="System.Net.Http.HttpClient"/>s</param>
 /// <param name="serializerProvider">The service used to provide <see cref="ISerializer"/>s</param>
 /// <param name="oauth2TokenManager">The service used to manahge <see cref="OAuth2Token"/>s</param>
 /// <param name="options">The service used to access the current <see cref="ApplicationOptions"/></param>
 /// <param name="activity">The <see cref="V1WorkflowActivity"/> to process</param>
 /// <param name="action">The <see cref="ActionDefinition"/> to process</param>
 /// <param name="function">The <see cref="FunctionDefinition"/> to process</param>
 public ODataFunctionProcessor(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, IWorkflowRuntimeContext context, IWorkflowActivityProcessorFactory activityProcessorFactory,
                               IHttpClientFactory httpClientFactory, ISerializerProvider serializerProvider, IOptions <ApplicationOptions> options, V1WorkflowActivity activity,
                               ActionDefinition action, FunctionDefinition function)
     : base(serviceProvider, loggerFactory, context, activityProcessorFactory, options, activity, action, function)
 {
     this.HttpClient         = httpClientFactory.CreateClient();
     this.SerializerProvider = serializerProvider;
 }
Exemplo n.º 7
0
 public MemoryCacheProvider(ISerializerProvider serializerProvider)
 {
     if (serializerProvider == null)
     {
         throw new ArgumentNullException(nameof(serializerProvider));
     }
     SerializerProvider = serializerProvider;
 }
Exemplo n.º 8
0
 public InMemoryEventingMethod(
     IDefaultSerializerProvider defaultSerializerProvider,
     ISerializerProvider serializerProvider,
     IMessageHub messageHub)
 {
     _defaultSerializer  = defaultSerializerProvider.DefaultSerializer;
     _serializerProvider = serializerProvider;
     _messageHub         = messageHub;
 }
Exemplo n.º 9
0
 public RabbitMQMessageHandler(
     ILocalMethodRunner localTransitionRunner,
     ISerializerProvider serializerProvider,
     IServiceResolver serviceResolver)
 {
     _localTransitionRunner = localTransitionRunner;
     _serializerProvider    = serializerProvider;
     _serviceResolver       = serviceResolver;
 }
 public RabbitMQCommunicationMethod(
     IDefaultSerializerProvider defaultSerializerProvider,
     ISerializerProvider serializerProvider,
     IConnectionManager connectionManager)
 {
     _defaultSerializer  = defaultSerializerProvider.DefaultSerializer;
     _serializerProvider = serializerProvider;
     _connectionManager  = connectionManager;
 }
Exemplo n.º 11
0
 public SessionCacheProvider(IHttpContextAccessor httpContextAccessor, ISerializerProvider serializerProvider)
 {
     if (httpContextAccessor == null)
     {
         throw new ArgumentNullException(nameof(httpContextAccessor));
     }
     HttpContext        = httpContextAccessor.HttpContext;
     SerializerProvider = serializerProvider ?? throw new ArgumentNullException(nameof(serializerProvider));
 }
Exemplo n.º 12
0
 public CassandraPersistenceMethod(
     IDefaultSerializerProvider defaultSerializerProvider,
     ISerializerProvider serializerProvider,
     IEnumerable <IConfiguration> safeConfiguration)
 {
     _defaultSerializer  = defaultSerializerProvider.DefaultSerializer;
     _serializerProvider = serializerProvider;
     _configuration      = safeConfiguration.FirstOrDefault();
 }
Exemplo n.º 13
0
 public MemoryCache(ISerializerProvider serializerProvider)
 {
     if (serializerProvider == null)
     {
         throw new ArgumentNullException(nameof(serializerProvider));
     }
     SerializerProvider = serializerProvider;
     _Entries           = new ConcurrentDictionary <string, MemoryCache.CacheEntry>();
 }
Exemplo n.º 14
0
        public EventingMiddleware(
            ISerializerProvider serializerProvider,
            IEventSubscriber eventSubscriber)
        {
            _serializerProvider = serializerProvider;
            _jsonSerializer     = _serializerProvider.GetSerializer("json");
            _eventSubscriber    = eventSubscriber;

            _eventingPath = "/dev/events";
        }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new <see cref="V1ArchiveWorkflowInstanceCommandHandler"/>
 /// </summary>
 /// <param name="loggerFactory">The service used to create <see cref="ILogger"/>s</param>
 /// <param name="mediator">The service used to mediate calls</param>
 /// <param name="mapper">The service used to map objects</param>
 /// <param name="options">The service used to access the current <see cref="SynapseApplicationOptions"/></param>
 /// <param name="serializerProvider">The service used to provide <see cref="ISerializer"/>s</param>
 /// <param name="workflows">The <see cref="IRepository"/> used to manage <see cref="V1Workflow"/>s</param>
 /// <param name="workflowInstances">The <see cref="IRepository"/> used to manage <see cref="V1WorkflowInstance"/>s</param>
 /// <param name="workflowProcesses">The <see cref="IRepository"/> used to manage <see cref="V1WorkflowProcess"/>es</param>
 public V1ArchiveWorkflowInstanceCommandHandler(ILoggerFactory loggerFactory, IMediator mediator, IMapper mapper, IOptions <SynapseApplicationOptions> options,
                                                ISerializerProvider serializerProvider, IRepository <V1Workflow> workflows, IRepository <V1WorkflowInstance> workflowInstances, IRepository <V1WorkflowProcess> workflowProcesses)
     : base(loggerFactory, mediator, mapper)
 {
     this.Options           = options.Value;
     this.Serializer        = serializerProvider.GetSerializer(this.Options.Archiving.SerializerType);
     this.Workflows         = workflows;
     this.WorkflowInstances = workflowInstances;
     this.WorkflowProcesses = workflowProcesses;
 }
        public JObject Serialize(IElement dataSource, ISerializerProvider provider)
        {
            var res = new JObject();

            foreach (var member in dataSource.Members)
            {
                res.Add(this.GetSerializer(member).Serialize(member, this, this));
            }

            return res;
        }
Exemplo n.º 17
0
 public InMemoryMessageHandler(
     IMessageHub messageHub,
     ILocalMethodRunner localTransitionRunner,
     ISerializerProvider serializerProvider,
     IServiceResolver serviceResolver)
 {
     _messageHub            = messageHub;
     _localTransitionRunner = localTransitionRunner;
     _serializerProvider    = serializerProvider;
     _serviceResolver       = serviceResolver;
 }
        public JToken Serialize(
            IModelMember dataSource, 
            ISerializerProvider provider, 
            IElementSerializer elementSerializer)
        {
            var elDataSource = dataSource as IModelElementMember;

            var res = new JProperty(elDataSource.Name);
            res.Value = elementSerializer.Serialize(elDataSource.Element, provider);
            return res;
        }
 public InMemoryCommunicationMethod(
     IDefaultSerializerProvider defaultSerializerProvider,
     ISerializerProvider serializerProvider,
     IMessageHub messageHub,
     IMethodStateStorageProvider methodStateStorageProvider)
 {
     _defaultSerializer          = defaultSerializerProvider.DefaultSerializer;
     _serializerProvider         = serializerProvider;
     _messageHub                 = messageHub;
     _methodStateStorageProvider = methodStateStorageProvider;
 }
Exemplo n.º 20
0
 public FileStorage(
     ISerializer serializer,
     ISerializerProvider serializerProvider,
     string stateDirectory,
     string resultsDirectory)
 {
     _serializer         = serializer;
     _serializerProvider = serializerProvider;
     _stateDirectory     = stateDirectory;
     _resultsDirectory   = resultsDirectory;
 }
Exemplo n.º 21
0
        public async Task <Guid> OpenAsync()
        {
            if (this.ServiceState != ServiceState.None)
            {
                throw new InvalidOperationException();
            }
            this.ServiceState = ServiceState.Opening;
            this.Dispatcher   = await Dispatcher.CreateAsync(this);

            try
            {
                await this.Dispatcher.InvokeAsync(() =>
                {
                    this.token = ServiceToken.NewToken();
                    this.serializerProvider = this.componentProvider.GetserializerProvider(this.SerializerType);
                    this.serializer         = this.serializerProvider.Create(this, this.componentProvider.DataSerializers);
                    this.Debug($"{this.serializerProvider.Name} Serializer created.");
                    this.adpatorHostProvider = this.componentProvider.GetAdaptorHostProvider(this.AdaptorHostType);
                    this.adaptorHost         = this.adpatorHostProvider.Create(this, this.instanceContext, token);
                    this.Debug($"{this.adpatorHostProvider.Name} Adaptor created.");
                    this.adaptorHost.Disconnected += AdaptorHost_Disconnected;
                });

                await this.instanceContext.InitializeInstanceAsync();

                foreach (var item in this.ServiceHosts)
                {
                    await item.OpenAsync(token);

                    await this.DebugAsync($"{item.Name} Service opened.");
                }
                await this.adaptorHost.OpenAsync(this.Host, this.Port);

                await this.DebugAsync($"{this.adpatorHostProvider.Name} Adaptor opened.");

                await this.Dispatcher.InvokeAsync(() =>
                {
                    this.Debug($"Service Context opened.");
                    this.ServiceState = ServiceState.Open;
                    this.OnOpened(EventArgs.Empty);
                });

                return(this.token.Guid);
            }
            catch
            {
                this.ServiceState = ServiceState.None;
                await this.AbortAsync();

                throw;
            }
        }
        public void Deserialize(JObject dataSource, IElement destination, ISerializerProvider provider)
        {
            foreach (var member in destination.Members)
            {
                var currentMemberSource = dataSource[member.Name];
                if (currentMemberSource == null)
                {
                    continue;
                }

                this.GetSerializer(member).Deserialize(currentMemberSource, member, provider, this);
            }
        }
        public void Deserialize(
            JToken dataSource,
            IModelMember destination,
            ISerializerProvider provider,
            IElementSerializer elementSerializer)
        {
            var current = destination as IModelElementMember;

            var jObjDataSource = dataSource as JObject;
            if (jObjDataSource == null) return;

            elementSerializer.Deserialize(jObjDataSource, current.Element, provider);
        }
Exemplo n.º 24
0
 public RedisCache(IDatabase database, ISerializerProvider serializerProvider)
 {
     if (database == null)
     {
         throw new ArgumentNullException(nameof(database));
     }
     if (serializerProvider == null)
     {
         throw new ArgumentNullException(nameof(serializerProvider));
     }
     _Database           = database;
     _SerializerProvider = serializerProvider;
 }
        public void Deserialize(
            JToken dataSource,
            IModelMember destination,
            ISerializerProvider provider,
            IElementSerializer elementSerializer)
        {
            var jValue = dataSource as JValue;
            if (jValue == null) return;

            var current = destination as IModelAttributeMember;

            current.Value = jValue.ToObject(current.Type);
        }
Exemplo n.º 26
0
 public RedisProvider(string connectionAddress, ISerializerProvider serializerProvider)
 {
     if (connectionAddress == null)
     {
         throw new ArgumentNullException(nameof(connectionAddress));
     }
     if (serializerProvider == null)
     {
         throw new ArgumentNullException(nameof(serializerProvider));
     }
     _Conn = ConnectionMultiplexer.Connect(connectionAddress);
     _SerializerProvider = serializerProvider;
     LockerTimeout       = TimeSpan.FromMinutes(15);
 }
Exemplo n.º 27
0
        internal static void ProcessRequest(HttpContext context, ServiceInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (info == null || info.InvokeInfo == null)
            {
                throw new ArgumentNullException("info");
            }

            //if( context.Request.InputStream.Length == 0 )
            //    throw new InvalidDataException("没有调用数据,请将调用数据以请求体的方式传入。");

            if (info.InvokeInfo.AuthenticateRequest(context) == false)
            {
                ExceptionHelper.Throw403Exception(context);
            }

            // 获取客户端的数据序列化格式。
            //   默认实现方式:request.Headers["Serializer-Format"];
            //   注意:这是我自定义的请求头名称,也可以不指定,默认为:form (表单)
            string serializerFormat = FrameworkRules.GetSerializerFormat(context.Request);

            ISerializerProvider serializerProvider =
                SerializerProviderFactory.GetSerializerProvider(serializerFormat);

            if (serializerProvider is IRequireSetServiceInfo)
            {
                ((IRequireSetServiceInfo)serializerProvider).SetServiceInfo(info);
            }

            // 获取要调用方法的参数类型
            Type destType = info.InvokeInfo.MethodAttrInfo.ParamType;

            // 获取要调用的参数
            context.Request.InputStream.Position = 0;   // 防止其它Module读取过,但没有归位。
            object param = serializerProvider.Deserialize(destType, context.Request);

            // 调用服务方法
            object result = info.InvokeInfo.MethodAttrInfo.MethodInfo.Invoke(
                info.InvokeInfo.ServiceInstance, new object[] { param });

            // 写输出结果
            if (result != null)
            {
                serializerProvider.Serializer(result, context.Response);
            }
        }
Exemplo n.º 28
0
        public CassandraStateStorage(
            StateStorageSettings settings,
            ICluster cluster,
            ISerializer defaultSerializer,
            ISerializerProvider serializerProvider)
        {
            _settings           = settings;
            _cluster            = cluster;
            _serializerProvider = serializerProvider;

            _serializer =
                !string.IsNullOrEmpty(settings.Serializer)
                ? serializerProvider.GetSerializer(settings.Serializer)
                : defaultSerializer;
        }
 public static EventPublishData Read(Message message, ISerializerProvider serializerProvider, out bool skipLocalEvents)
 {
     skipLocalEvents = (bool)message.Data["SkipLocal"];
     return(new EventPublishData
     {
         IntentId = (string)message.Data["IntentId"],
         Service = (ServiceId)message.Data["Service"],
         Event = (EventId)message.Data["Event"],
         Caller = (CallerDescriptor)message.Data["Caller"],
         Parameters = new SerializedValueContainer(
             (string)message.Data["Format"],
             message.Data["Parameters"],
             serializerProvider)
     });
 }
 public static MethodContinuationData Read(Message message, ISerializerProvider serializerProvider)
 {
     return(new MethodContinuationData
     {
         IntentId = (string)message.Data["IntentId"],
         Service = (ServiceId)message.Data["Service"],
         Method = (PersistedMethodId)message.Data["Method"],
         TaskId = (string)message.Data["TaskId"],
         Caller = (CallerDescriptor)message.Data["Caller"],
         State = MethodInvocationDataTransformer.TryGetMethodContinuationState(message),
         Result = new SerializedValueContainer(
             (string)message.Data["Format"],
             message.Data["Result"],
             serializerProvider)
     });
 }
 public InvoicesController(IInvoiceService invoiceService,
                           ISubscriberService subscriberService,
                           IReportService reportService,
                           IInvoiceDataCapture invoiceDataCapture,
                           IPhoneService phoneService,
                           ISerializerProvider serializerProvider,
                           IMessageSender messageSender)
 {
     _invoiceService     = invoiceService;
     _subscriberService  = subscriberService;
     _reportService      = reportService;
     _invoiceDataCapture = invoiceDataCapture;
     _phoneService       = phoneService;
     _serializerProvider = serializerProvider;
     _messageSender      = messageSender;
 }
Exemplo n.º 32
0
        public HttpRequestHandler(
            ISerializerProvider serializerProvider,
            IUniqueIdGenerator idGenerator,
            IRoutineCompletionNotifier routineCompletionNotifier,
            IServiceResolver serviceResolver,
            IMethodResolver methodResolver,
            ILocalMethodRunner localTransitionRunner)
        {
            _idGenerator = idGenerator;
            _routineCompletionNotifier = routineCompletionNotifier;
            _serviceResolver           = serviceResolver;
            _methodResolver            = methodResolver;
            _localTransitionRunner     = localTransitionRunner;

            _serializerProvider = serializerProvider;
            _jsonSerializer     = _serializerProvider.GetSerializer("json");
        }
        public JToken Serialize(
            IModelMember dataSource, 
            ISerializerProvider provider, 
            IElementSerializer elementSerializer)
        {
            var colDataSource = dataSource as IModelCollectionMember;

            var arr = new JArray();
            var res = new JProperty(colDataSource.Name, arr);
            foreach (var element in colDataSource.Elements)
            {
                var newEl = elementSerializer.Serialize(element, provider);
                arr.Add(newEl);
            }

            return res;
        }
        public void Deserialize(
            JToken dataSource,
            IModelMember destination,
            ISerializerProvider provider,
            IElementSerializer elementSerializer)
        {
            var current = destination as IModelCollectionMember;

            var jArrayDataSource = dataSource as JArray;
            if (jArrayDataSource == null) return;

            foreach (var childJObject in jArrayDataSource.Children().OfType<JObject>())
            {
                var newEl = current.Elements.Create();
                elementSerializer.Deserialize(childJObject, newEl, provider);
            }
        }
 public static MethodInvocationData Read(Message message, ISerializerProvider serializerProvider)
 {
     return(new MethodInvocationData
     {
         IntentId = (string)message.Data["IntentId"],
         Service = (ServiceId)message.Data["Service"],
         Method = (MethodId)message.Data["Method"],
         Continuation = (ContinuationDescriptor)message.Data["Continuation"],
         ContinuationState = TryGetMethodContinuationState(message),
         Caller = (CallerDescriptor)message.Data["Caller"],
         FlowContext = (Dictionary <string, string>)message.Data["FlowContext"],
         Parameters = new SerializedValueContainer(
             (string)message.Data["Format"],
             message.Data["Parameters"],
             serializerProvider)
     });
 }
Exemplo n.º 36
0
        public BackgroundEventSubscriber(
            IEventSubscriber eventSubscriber,
            IServiceResolver serviceResolver,
            ICommunicationModelConfiguration communicationModelConfiguration,
            IDefaultSerializerProvider defaultSerializerProvider,
            ISerializerProvider serializerProvider,
            EventingMethod eventingMethod,
            ILocalMethodRunner localMethodRunner)
        {
            _eventSubscriber = eventSubscriber;
            _serviceResolver = serviceResolver;
            _communicationModelConfiguration = communicationModelConfiguration;
            _defaultSerializerProvider       = defaultSerializerProvider;
            _serializerProvider = serializerProvider;

            // DI circular reference
            eventingMethod.LocalMethodRunner = localMethodRunner;
        }
        public JToken Serialize(
            IModelMember dataSource, 
            ISerializerProvider provider, 
            IElementSerializer elementSerializer)
        {
            var dictDataSource = dataSource as IModelDictionaryMember;

            var dict = new JObject();
            var res = new JProperty(dictDataSource.Name, dict);
            foreach (var key in dictDataSource.Elements.Keys)
            {
                var newEl = new JProperty(key);
                newEl.Value = elementSerializer.Serialize(dictDataSource.Elements[key], provider);
                dict.Add(newEl);
            }

            return res;
        }
Exemplo n.º 38
0
 public Program(ISubscribersSystemMenu menu,
                IIoHelper ioHelper,
                ISystemDataCaptureService systemDataCaptureService,
                IDetailsDisplay detailsDisplay,
                ICombiningUserOfferService combiningUserOfferService,
                IPhoneSimulatorService phoneSimulatorService,
                IReportService reportService,
                ISerializerProvider serializerProvider)
 {
     _menu     = menu;
     _ioHelper = ioHelper;
     _systemDataCaptureService  = systemDataCaptureService;
     _detailsDisplay            = detailsDisplay;
     _combiningUserOfferService = combiningUserOfferService;
     _phoneSimulatorService     = phoneSimulatorService;
     _reportService             = reportService;
     _serializerProvider        = serializerProvider;
 }
        public void Deserialize(
            JToken dataSource,
            IModelMember destination,
            ISerializerProvider provider,
            IElementSerializer elementSerializer)
        {
            var current = destination as IModelDictionaryMember;

            var jObjDataSource = dataSource as JObject;
            if (jObjDataSource == null) return;

            foreach (var childJProp in jObjDataSource.Children().OfType<JProperty>())
            {
                var childJObj = childJProp.Value as JObject;
                if (childJObj == null) return;

                var newEl = current.Elements.Create(childJProp.Name);
                elementSerializer.Deserialize(childJObj, newEl, provider);
            }
        }
Exemplo n.º 40
0
 public SerializedValueContainer(
     string format,
     object serializedForm,
     ISerializerProvider serializerProvider)
 {
     _format             = format;
     _serializedForm     = serializedForm;
     _lazyValueContainer = new Lazy <IValueContainer>(() =>
     {
         var serializer = serializerProvider.GetSerializer(_format);
         if (_serializedForm is string text)
         {
             return(serializer.Deserialize <IValueContainer>(text));
         }
         else
         {
             return(serializer.Deserialize <IValueContainer>((byte[])_serializedForm));
         }
     });
 }
Exemplo n.º 41
0
        static WebAppConfig()
        {
            string appClassName = ConfigurationManager.AppSettings["WebAppClassName"];
            _version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            _templateCacheDuration = Convert.ToInt32(ConfigurationManager.AppSettings["TemplateCacheDuration"]);
            _templateFileEncoding = string.IsNullOrEmpty(ConfigurationManager.AppSettings["TemplateFileEncoding"]) ? Encoding.Default : Encoding.GetEncoding(ConfigurationManager.AppSettings["TemplateFileEncoding"]);

            bool.TryParse(ConfigurationManager.AppSettings["EnabledHttpCompress"], out _enabledHttpCompress);

            string enabledPermission = ConfigurationManager.AppSettings["EnabledPermission"];

            string defaultLanguageCode = ConfigurationManager.AppSettings["DefaultLanguageCode"];

            if (defaultLanguageCode != null && defaultLanguageCode.Length >= 2)
            {
                _defaultLanguageCode = defaultLanguageCode;
            }

            _extension = ConfigurationManager.AppSettings["Extension"] ?? string.Empty;

            _appKey = ConfigurationManager.AppSettings["AppKey"];
            _appSecret = ConfigurationManager.AppSettings["AppSecret"];
            _oAuthUri = ConfigurationManager.AppSettings["OAuthUri"];

            //if (string.IsNullOrEmpty(_appKey))
            //    throw new CException("AppKey not found, please check the Web.config's configuration/appSettings.");

            //if (string.IsNullOrEmpty(_appSecret))
            //    throw new CException("AppSecret not found, please check the Web.config's configuration/appSettings.");

            //if (string.IsNullOrEmpty(_oAuthUri))
            //    throw new CException("OAuthUri not found, please check the Web.config's configuration/appSettings.");

            //if (string.IsNullOrEmpty(_publicKey))
            //    throw new CException("PublicKey not found, please check the Web.config's configuration/appSettings.");

            //if (string.IsNullOrEmpty(_privateKey))
            //    throw new CException("PrivateKey not found, please check the Web.config's configuration/appSettings.");

            if (!string.IsNullOrEmpty(enabledPermission))
                bool.TryParse(enabledPermission, out _enabledPermission);

            if (string.IsNullOrEmpty(appClassName))
                throw new CException("WebAppClassName not found, please check the Web.config's configuration/appSettings.");

            Type appType = Type.GetType(appClassName, false);

            if (appType == null)
                throw new CException("Can not load the type of WebAppClassName '" + appClassName + "'");

            MethodInfo initMethod = appType.GetMethod("Init", new Type[0]);

            if (initMethod == null || !initMethod.IsStatic)
                throw new CException("Can not found the static Init method of " + appType.FullName);

            RegisterAssembly(appType.Assembly);

            initMethod.Invoke(null, null);

            if (_sessionType == null)
                throw new CException("WebAppConfig.SessionType is null.");

            if (_securityType == null)
                throw new CException("WebAppConfig.SecurityType is null.");

            LoadControllerClasses();

            if (_timeProvider == null)
            {
                _timeProvider = new RealTimeProvider();
            }

            if (_deserializeProvider == null)
            {
                _deserializeProvider = new JSONDeserializer();
            }

            if (_serializeProvider == null)
            {
                _serializeProvider = new JSONSerializer();
            }

            if (_securityProvider == null)
            {
                _securityProvider = MiniSecurity.CreateInstance();
            }

            if (_stringFilterProvider == null)
            {
                _stringFilterProvider = new MFilter();
            }
        }