How to edit the source code of the Microsoft Visual Studio 2010 (Enterprise) Enterprise Library?

Hi experts!

I downloaded the MS Enterprise Library for using the Logging Block for Visual Studio 2010 Enterprise. All works fine so far.

Now I modified the Stored Procedure (WriteLog) to catch more information about the client.
Therefore I first modified the LogEntry class to give it more information (some Properties were added). I compiled the code to dll and copied it to the Enterprise Library main folder (Program Files).
In my project, the new properties are now known.
The I recompiled my Project to see, if it works. And it didn't work. There is an error, when accessing the EntryLog class while creating a new instance of it.

Notice: I tried out the ExtendedProperties.Add() method. It is not, what I'm looking for. I really need  those information in separate columns in my logging table.

I attatched the project of the modified Logging Block (i only modified the LogEntry.cs) and the code snippet of my instancing of LogEntry (where the rror occurs).   Runtime error while instancing from LogEntry class
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Logging.Filters;
using Microsoft.Practices.EnterpriseLibrary.Logging.Formatters;
using Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners;

using MSLogging = Microsoft.Practices.EnterpriseLibrary.Logging;

namespace Angara.Core.Crosscutting.Logging
{
	public class Logging : IDisposable
	{

		public void WriteLog(ILogEntry Log)
		{
			Console.WriteLine("Method: " + Log.CallingMethodName);
			Console.WriteLine("Namespace: " + Log.CallingNamespace);
			Console.WriteLine("Message: " + Log.Message);

			MSLogging.LogEntry msLogEntry = new MSLogging.LogEntry();

			msLogEntry.Message = Log.Message;
			msLogEntry.Severity = Log.EventType;
			msLogEntry.Categories.Add("General");
			msLogEntry.Priority = 100;
			msLogEntry.CallingMethodName = Log.CallingMethodName;
			msLogEntry.CallingNamespace = Log.CallingNamespace;
			//msLogEntry.ExtendedProperties.Add("CallingMethodName", Log.CallingMethodName);

			MSLogging.Logger.Write(msLogEntry);

			msLogEntry = null;
		}

		~Logging()
		{
			this.Dispose();
		}

		public void Dispose()
		{
		}
	}
}

Open in new window

kankmanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrRanyCommented:
After copying a new DLL have you added it as reference to your project?
0
kankmanAuthor Commented:
Hi,

yes, I removed the old reference "Microsoft.Practices.EnterpriseLibrary.Logging" and added a new one.
When adding the new one, the Namespace "Microsoft.Practices.EnterpriseLibrary.Logging" was not listed. I had to choose it manually. Buit I copied it to C:\Programme\Microsoft Enterprise Library 5.0\Bin\Microsoft.Practices.EnterpriseLibrary.Logging.dll, where the original file was.

Mybe it's importaint: I increased the Version of the assembly from original 5.0.414.0 to 5.1.0.
0
mrRanyCommented:
I think the problem is in that you are copying wrong DLL file.
I downloaded Enterprise Libriry 5.0 with Source Code.
Installed it in C:\Users\MyUserName\Documents\EntLib50Src.
Added 2 fields CallingMethodName and CallingNamespace.
Changed version to 5.1 according to your description.
Compiled and added a reference from my project to the DLL.
On  MSLogging.LogEntry msLogEntry = new MSLogging.LogEntry(); got your error so checked that the version of required DLL is wrong.
After that I've checked in project properties where it really stores debug and release version of DLL and found it in EntLib50Src\Blocks\bin.
Now, referencing to this DLL everything working good.
Hope it will help.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kankmanAuthor Commented:
Hi, I took the right source, I think. But according to your comment, I found out, that there was a second DLL modified.

Microsoft.Practices.EnterpriseLibrary.Common.dll

I did not copied it to the Program Files folder. after I did this, It compiled correctly.
0
mrRanyCommented:
At least you found it, glad that can help anyway. Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.