How to make configuration available in tool (Entlib v5)

Oct 7, 2010 at 4:15 PM

I would like to make my custom configuration section available in the Enterprise Library Configuration Tool.

How can I do this? I've attempted to extend the AddApplicationBlockCommand and SectionViewModel classes and copied my assemblies to where the tool can see them, but they get filtered out in the MenuCommandService.EnsureCommands procedure.

I've looked at some simpler blocks like security and caching and am still not getting the picture of what I need to do. Are there any dumbed-down/simple examples?

Oct 8, 2010 at 1:51 AM

I have yet to try it out using the latest version.  In the meantime, have you seen this thread?  I'll give you an update on any progress.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 8, 2010 at 4:07 PM

Yeah, I did see that thread, which led me to look at the security block.

I can see that the assemblyLocator is finding my assembly, but the filter is filtering it out. I'm stepping through this bit of EnsureCommands in the MenuCommandService:

                var globalAssemblyCommands = this.assemblyLocator.Assemblies
                   .FilterSelectManySafe(x => x.GetCustomAttributes(typeof(CommandAttribute), true).OfType<CommandAttribute>())
                   .Select(x => builder.Resolve(x.CommandModelType, new DependencyOverride(x.GetType(), x)))
                   .Cast<CommandModel>();

I am likely missing the bit about what to attribute with the CommandAttribute.

Thanks a lot for replying Sarah and for any thoughts you may have!

Kelly

Oct 8, 2010 at 6:01 PM

I figured out the piece I was missing. It was the assembly attributes in my AssemblyInfo.cs file:

[assembly: HandlesSection(RemoteConnectsSection.SectionName)]
[assembly: AddApplicationBlockCommand(
            RemoteConnectsSection.SectionName,
            typeof(RemoteConnectsSection),
            TitleResourceName = "AddRemoteConnectsSettings",
            TitleResourceType = typeof(DesignResources),
            CommandModelTypeName = RemoteConnectsDesignTime.CommandTypeNames.AddRemoteConnectsBlockCommand)]

All is well now. :)

Oct 11, 2010 at 1:04 AM

Glad to hear that.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com