enterprise-library

Enterprise Library 6 - dynamically change log file name

不问归期 提交于 2021-02-18 19:00:13
问题 Is it possible to dynamically set log folder and file name in C# which overrides the config value(file name) in the Listeners section of logging configuration? Tried to follow the below link but it is applicable only for EL 5 Log messages going to previously created log file This is how i Initialize EL Logging: IConfigurationSource configurationSource = ConfigurationSourceFactory.Create(); LogWriterFactory logWriterFactory = new LogWriterFactory(configurationSource); Logger.SetLogWriter

dotNet core (console app) with Enterprise Library Data (EnterpriseLibrary.Data.NetCore) and JSON

喜夏-厌秋 提交于 2021-02-10 06:27:06
问题 I am trying to use: EnterpriseLibrary.Data.NetCore .nuget\packages\enterpriselibrary.data.netcore\6.0.1313 https://www.nuget.org/packages/EnterpriseLibrary.Data.NetCore/ .NET Core 2.1 I have the following JSON { "ConnectionStrings": { "MyDefaultConnectionName": "Server=.\\MyInstance;Database=MyDB;Trusted_Connection=True;MultipleActiveResultSets=true" } } And this code works fine (in my Program.cs dotnet console app) (simple showing my appsettings.json is being picked up, and it looks like my

How to elegantly log contextual information along with every message

ぐ巨炮叔叔 提交于 2021-02-07 14:20:58
问题 I'm looking for some advice on logging. I've written a wrapper called Logger which internally uses Microsoft Enterprise Library 5.0. Currently it enables us to log in this way: Logger.Error(LogCategory.Server, "Some message with some state {0}", state); The problem I face is that every log in the EventViewer seems to be unrelated even though some of them are somehow related, for example they all come from processing a request from a particular client. Let me elaborate on the problem. Suppose

How to elegantly log contextual information along with every message

十年热恋 提交于 2021-02-07 14:16:59
问题 I'm looking for some advice on logging. I've written a wrapper called Logger which internally uses Microsoft Enterprise Library 5.0. Currently it enables us to log in this way: Logger.Error(LogCategory.Server, "Some message with some state {0}", state); The problem I face is that every log in the EventViewer seems to be unrelated even though some of them are somehow related, for example they all come from processing a request from a particular client. Let me elaborate on the problem. Suppose

Microsoft.Practices.ObjectBuilder2.dll not found after installing Enterprise Lib 5.0

╄→гoц情女王★ 提交于 2021-02-07 07:19:42
问题 I have recently installed Enterprise library 5.0 but I am unable to find "Microsoft.Practices.ObjectBuilder2.dll". I am working on CALTutorial where I will need this dll as reference. Can anybody answer this? Thanks, Omky 回答1: There is breaking change in EntLib 5. The library help file mentioned about this which says that code for "Microsoft.Practices.ObjectBuilder2.dll" is included in Unity assembly hence no need of separate reference. 回答2: In case anyone else has a similar issue, I am

Transient Fault Handling with Azure database

不想你离开。 提交于 2021-01-27 23:04:41
问题 We are using ReliableSqlConnection from Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling to support transient fault handling for Azure database, we are on .NET 4.6.1. The thing is randomly we got exception: "Internal .Net Framework Data Provider error 6" when trying to open connection with this class. ReliableSqlConnection does not support async await , but built-in transient fault handling with ConnectRetryInterval and ConnectRetryCount on ADO.NET 4.6.1 only support at connection

Enterprise Library not finding config source files in asp.net app

隐身守侯 提交于 2021-01-27 09:36:04
问题 I have my config files in the base directory, set to Content/copy always, in my asp .net web project and when the app runs, it says cannot find the files. <enterpriseLibrary.ConfigurationSource selectedSource="System Configuration Source"> <sources> <add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" /> <!--<add

Enterprise Library not finding config source files in asp.net app

可紊 提交于 2021-01-27 09:35:11
问题 I have my config files in the base directory, set to Content/copy always, in my asp .net web project and when the app runs, it says cannot find the files. <enterpriseLibrary.ConfigurationSource selectedSource="System Configuration Source"> <sources> <add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" /> <!--<add

DbType equivalent to SqlDbType.Bit

烂漫一生 提交于 2021-01-27 04:47:34
问题 Does anyone know what is the DbType equivalent to SqlDbType.Bit? I am trying to convert param[0] = new SqlParameter("@Status", SqlDbType.Bit); param[0].Value = Status; to db.AddInParameter(dbCommand, "@Status", <DbType dbType>, Status); but I don't know which DbType to use to represent a single Bit. Any ideas? 回答1: The database type bit is represented as a boolean on the server side, so the corresponding DbType value is DbType.Boolean . 回答2: DbType.Boolean: A simple type representing Boolean

DbType equivalent to SqlDbType.Bit

社会主义新天地 提交于 2021-01-27 04:47:33
问题 Does anyone know what is the DbType equivalent to SqlDbType.Bit? I am trying to convert param[0] = new SqlParameter("@Status", SqlDbType.Bit); param[0].Value = Status; to db.AddInParameter(dbCommand, "@Status", <DbType dbType>, Status); but I don't know which DbType to use to represent a single Bit. Any ideas? 回答1: The database type bit is represented as a boolean on the server side, so the corresponding DbType value is DbType.Boolean . 回答2: DbType.Boolean: A simple type representing Boolean