Quantcast
Channel: patterns & practices – Enterprise Library
Viewing all 1928 articles
Browse latest View live

New Post: Can pass objects to the event writer method

$
0
0
You can mark methods with the NonEventAttribute to prevent EventSource from including methods in the manifest:
[Event(3, Message = "Could not parse {0} file with name {1}", Level = EventLevel.Error)]
internal void FileParsingError(string fileType, string fileName, string exceptionMessage, string stackTrace)
{
    WriteEvent(3, fileType, fileName);
}

[NonEvent]
internal void FileParsingError(string fileType, string fileName, Exception ex)
{
    FileParsingError(fileType, fileName, ex.Message, ex.StackTrace);
}
Use like this:
try
{
    KraftvaerkEventSource.Log.StartedFileParsing("Example", "file2.csv");
    throw new Exception("Some parsing error");
}
catch (Exception ex)
{
    KraftvaerkEventSource.Log.FileParsingError("Example", "file2.csv", ex);
}
On a side note: I found this NonEvent attribute by decompiling the EventSource class and looking at the implementation of CreateManifest. Maybe you should include this feature in the developers guide, and include an example for EventSource on MSDN.

New Post: Log ASP.NET Web API (Service) Trace into Database

New Post: Can pass objects to the event writer method

$
0
0
Thanks for posting -- that's a good find!

It looks like it was hiding in plain sight at MSDN. I do think it's a good idea to highlight the usage since I could see this being a common scenario.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

New Post: Support for .net 4.0

$
0
0
My current application uses framework 4.0 and doesn't have test resources to migrate to framework 4.5.

I've managed to get EventSourceDemoV3.5 solution which has EventSource.dll. This helps me write code for older versions of the framework.

The issue that I face right now is that in the V3.5 demo, the events are only captures through PerView tool.

If I want to create listeners and write logs without PerView, is that possible or do I have to write my custom listeners?

Secondly does V3.5 dll support out of process logging?

Third, do you folks have plans to release the RTM in 4.0 framework?

Thanks,
Himanshu

New Post: SLAB logging to Windows EventLog

$
0
0
Hi there,

After reviewing the design doc, I found SLAB will provide logging to Windows EventLog support, while in the current CTP, seems there is no EventlogEventListener yet. We are testing the WindowsAzureEventListener, it's working great. Just wonder will EventLogEventListener be released in next CTP? And When will be the next CTP? Thanks a lot.

ZF

New Post: Call for information: Unknow bug in EntLib 4.1 (caching block)?

$
0
0
Altinn is the Norwegian public reporting portal. This is a portal where Norwegians can among other things "do their taxes". The portal has been known for breaking down each year when all the Norwegians login at the same time to check if they get money in return or need to pay more tax.

This year an issue occured where some users got to see another user's data. They fixed the issue and later released a statement claiming the problem was an unknown bug in Enterprise Library 4.1. I assume it was in the caching block, but details were scarse. Also they say the problem is fixed in 5.0, but neither fixed nor listed as an issue in 4.1

Now to my question. Anyone know any more details about this issue? We are using the 4.1 caching block in a large project. Migrating to 5.0 is not planned for now and I'd like to know if this unknown bug can affect us and if it's patchable.

Source:
http://www.digi.no/914815/microsoft-bibliotek-sviktet-altinn

Google translated:
http://translate.google.no/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&eotf=1&u=http%3A%2F%2Fwww.digi.no%2F914815%2Fmicrosoft-bibliotek-sviktet-altinn&act=url

New Post: Planned support for WindowsAzure.Storage 2.0.x ?

$
0
0
I'm trying to play with this, it doesn't look like the AzureExtensions is updated. AzureStorageExtensions.AsAzureStorageClientRetryPolicy still returns a 1.7 StorageClient.RetryPolicy. What am I missing? Or is there a new converter class for storage 2.0?

New Post: Planned support for WindowsAzure.Storage 2.0.x ?

$
0
0
Rock2000, are you using the latest version from NuGet?

New Post: Planned support for WindowsAzure.Storage 2.0.x ?

$
0
0
Yes, I just grabbed the latest Enterprise Library 5.0 - Transient Fault Handling Block from NuGet. In Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.AzureStorage there is the AzureStorageExtensions class, but it only has the AsAzureStorageClientRetryPolicy method, which returns a RetryPolicy object for Microsoft.WindowsAzure.StorageClient (1.7).

New Post: Planned support for WindowsAzure.Storage 2.0.x ?

$
0
0
You are right. This is one of the stories on the backlog which haven't been implemented yet. It’s not just a matter of recompiling it to target 2.0. I'll advise when it's done.
Grigori

Updated Wiki: Enterprise Library 6 Upgrade Instructions

New Post: Track Service Management Requests

$
0
0
What are the values that are stored in a queue when 'trackServiceManagementRequests' is set to true? I've figured out that the message is a base64 encoded string, but I'm not sure what all the values in the message are.

For example, decoding the messages provides me with a string such as the following:
MyAzureSubscription|
[MY SUBSCRIPTION ID|
My|
CurrentUser|
[MANAGEMENT CERT THUMBPRINT]|
[SERVICE NAME]|
Staging|
[MANAGEMENT OPERATION ID]|
[SOME UNKNOWN VALUE]

What is the last value in this |-delimited list?

New Post: Support for .net 4.0

$
0
0
The Semantic Logging Application Block targets .NET Framework 4.5. It uses .NET Framework classes such as EventSource that are only available in .NET 4.5.

I don't believe there are any plans to target .NET 4.0 with this block.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

New Post: SLAB logging to Windows EventLog

$
0
0
I haven't heard an update on the timeline for EventLog support. I know the team is busy but I'll try and find out.

Thanks for taking the Semantic Logging Application Block for a test drive!

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

New Post: Track Service Management Requests

$
0
0
There are 9 pieces of information stored as pipe delimited string and then Base 64 encoded. The data elements stored are:
  • Subscription Name
  • Subscription ID
  • Certificate Store Name
  • Certificate Store Location
  • Management Certificate Thumbprint
  • DNS Prefix
  • Deployment Slot Name
  • Request ID
  • Evaluation ID
Evaluation ID, AKA ConfigurationChangeRequest.EvaluationId, is a GUID value that can be used to correlate log messages. For example, when logging is enabled you can see what steps (e.g. rule evaluations) were taken before determining to send a change request.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

New Post: Track Service Management Requests

New Post: Design time support for custom validator - Validation Application Block

$
0
0
I have created Custom validator using Validation Application Block. Its working fine. But how to give design time support for the same validator. I have to use this custom validator in Enterprice Library Configuration Application Console How?

This is Custom Validator Code..

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public class StringIsNullOrEmptyAttribute : ValueValidatorAttribute
{
    protected override Validator DoCreateValidator(Type targetType)
    {
        return new StringIsNullOrEmpty(this.MessageTemplate, this.Negated);
    }
}

public class StringIsNullOrEmpty : ValueValidator<string>
{
    public StringIsNullOrEmpty(string messageTemplate, bool negated)
        : base(messageTemplate, null, negated)
    {
    }

    protected override void DoValidate(string objectToValidate, object currentTarget, string key, ValidationResults validationResults)
    {
        if (string.IsNullOrEmpty(objectToValidate) != Negated)
        {
            LogValidationResult(validationResults, GetMessage(objectToValidate, key), currentTarget, key);
        }
    }

    protected override string DefaultNegatedMessageTemplate
    {
        get
        {
            return "Field cannot have a value.";
        }
    }

    protected override string DefaultNonNegatedMessageTemplate
    {
        get
        {
            return "Field is required.";
        }
    }
}
Image

Reviewed: Enterprise Library 5.0 - April 2010 (Apr 15, 2013)

$
0
0
Rated 1 Stars (out of 5) - I'm not able to open the file , please help...

Created Unassigned: Allow configuration of using System.Configuration.Configuration object [33747]

$
0
0
My application uses custom configuration, as we have multiple office addins / standalone exes. I use an ExeConfigurationFileMap to load these .config files up and I get a nice System.Configuration.Configuration object I use to read my configs. I would like to also use this same approach for enterprise library, but the FileConfigurationSource takes a single file.

I ended up creating a wrapper that inherits from IConfigurationSource and uses a System.Configuration.Configuration (see attachment).

Another solution would be to allow the FileConfigurationSource to accept multiple file paths and merge the elements similar to the ConfigurationFileMap classes in .NET

New Post: Design time support for custom validator - Validation Application Block

$
0
0
You might consider looking at the Enterprise Library 5.0 - Extensibility Labs. There isn't a specific validation scenario but it does have an exercise on plugging into the config tool which could be helpful.

Basically, you should create a configuration class typically called [ValidatorName]Data. So, in your case it would be StringIsNullOrEmptyData (the Enterprise Library validators end with "Validator" so you may want to follow that convention). This class will extend Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValueValidatorData. A simple example would be:
    [ResourceDescription(typeof(DesignResources), "StringIsNullOrEmptyDataDescription")]
    [ResourceDisplayName(typeof(DesignResources), "StringIsNullOrEmptyDataDisplayName")]
    public class StringIsNullOrEmptyData : ValueValidatorData
    {
        public StringIsNullOrEmptyData() { Type = typeof(StringIsNullOrEmpty); }

        public StringIsNullOrEmptyData(string name) : base (name, typeof(StringIsNullOrEmpty))
        {
        }

        protected override Validator DoCreateValidator(Type targetType)
        {
            return new StringIsNullOrEmpty(MessageTemplate, Negated);
        }        
    }
Then you need to apply the ConfigurationElementType attribute to the validator:
    [ConfigurationElementType(typeof(StringIsNullOrEmptyData))]
    public class StringIsNullOrEmpty : ValueValidator<string>
    {
        public StringIsNullOrEmpty(string messageTemplate, bool negated)
            : base(messageTemplate, null, negated)
        {
        }
    //...
    }
The final step is to deploy the assembly to the same directory as the configuration tool and now you should have full integration with the configuration tool.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Viewing all 1928 articles
Browse latest View live