Exemplo n.º 1
0
        public LoggingEntityApp(string schema = "log", LogModules includeModules = LogModules.All,
                                UserSessionSettings sessionSettings = null) : base("LoggingApp", CurrentVersion)
        {
            var area = base.AddArea(schema);

            ActiveModules = includeModules;
            // DbInfo module is not shared with main app, it is local for the database
            var dbInfo = new DbInfoModule(area);

            // ErrorLog is property in EntityApp, will be set there automatically
            if (ActiveModules.IsSet(LogModules.ErrorLog))
            {
                var errLog = new ErrorLogModule(area);
            }
            if (ActiveModules.IsSet(LogModules.OperationLog))
            {
                OperationLog = new OperationLogModule(area);
            }
            if (ActiveModules.IsSet(LogModules.IncidentLog))
            {
                IncidentLog = new IncidentLogModule(area);
            }
            if (ActiveModules.IsSet(LogModules.TransactionLog))
            {
                TransactionLog = new TransactionLogModule(area, trackHostApp: false); //do not track changes for LoggingApp itself
            }
            if (ActiveModules.IsSet(LogModules.NotificationLog))
            {
                NotificationLog = new NotificationLogModule(area);
            }
            if (ActiveModules.IsSet(LogModules.LoginLog))
            {
                LoginLog = new LoginLogModule(area);
            }
            if (ActiveModules.IsSet(LogModules.DbUpgradeLog))
            {
                DbUpgradeLog = new DbUpgradeLogModule(area);
            }
            if (ActiveModules.IsSet(LogModules.UserSession))
            {
                SessionService = new UserSessionModule(area, sessionSettings);
            }
            if (ActiveModules.IsSet(LogModules.EventLog))
            {
                EventLogService = new EventLogModule(area);
            }
            if (ActiveModules.IsSet(LogModules.WebCallLog))
            {
                WebCallLog = new WebCallLogModule(area);
            }
            if (ActiveModules.IsSet(LogModules.WebClientLog))
            {
                WebClientLogService = new WebClientLogModule(area);
            }
        }
Exemplo n.º 2
0
        public WebApiClient(OperationContext context, WebApiClientSettings settings)
        {
            Context = context;
            Util.Check(Context != null, "Context parameter may not be null.");
            Util.Check(settings != null, "Settings parameter may not be null.");
            Util.Check(settings.ContentSerializer != null, "Settings.Serializer property may not be null.");
            Settings = settings;
            if (settings.Options.IsSet(ClientOptions.EnableLog))
            {
                _log = Settings.Log ?? Context.App.GetService <IWebClientLogService>();
            }
            //Create default headers with content type for deserializers
            DefaultRequestHeaders = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            var mediaTypes = Settings.ContentSerializer.MediaTypes;

            if (mediaTypes.Count > 0)
            {
                DefaultRequestHeaders.Add("accept", string.Join(", ", mediaTypes));
            }
            Client = SharedHttpClient;
        }
Exemplo n.º 3
0
 public WebApiClientSettings(string serviceUrl, ClientOptions options = ClientOptions.Default,
                             ApiNameMapping nameMapping    = ApiNameMapping.Default, string clientName = null,
                             IContentSerializer serializer = null, IWebClientLogService log            = null,
                             Type badRequestContentType    = null, Type serverErrorContentType         = null)
 {
     Util.Check(!string.IsNullOrWhiteSpace(serviceUrl), "ServiceUrl may not be empty.");
     if (serviceUrl.EndsWith("/"))
     {
         serviceUrl = serviceUrl.Substring(0, serviceUrl.Length - 1);
     }
     ServiceUrl        = serviceUrl;
     Options           = options;
     NameMapping       = nameMapping;
     ClientName        = clientName;
     ContentSerializer = serializer ?? new JsonContentSerializer(options, nameMapping);
     Log = log;
     ServerErrorContentType       = serverErrorContentType ?? typeof(string);
     BadRequestContentType        = badRequestContentType ?? ServerErrorContentType;
     ThrowClientFaultOnBadRequest = BadRequestContentType == typeof(List <ClientFault>) || BadRequestContentType == typeof(IList <ClientFault>) ||
                                    BadRequestContentType == typeof(ClientFault[]);
 }