Looking through the code I found that both NUnit.FormatterElement and
TStampTask define an element named "formatter". I know this is fine now,
since you looking at TaskNameAttributes, but should this be fixed?
If these are to be unique, it might make sense to keep a static class
that can be used to guarantee this type of uniqueness within the
ElementNameAttribute class.
Something like a thread-safe version of this?
static StringCollection ElementNames = new StringCollection();
public ElementNameAttribute(string name) {
if(ElementNames.Contain(name)
//throw exception!
else
ElementNames.Add(name);
_name = name;
}
Or am I missing something about the design here?
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Ian
MacLean
Sent: Monday, April 15, 2002 7:17 PM
To: Scott Hernandez
Cc: [EMAIL PROTECTED]
Subject: Re: [nant-dev] ElementNameAttribute and BuildElementAttribute
Scott Hernandez wrote:
> I don?t know much about the development history so this may be a dumb
> question.
>
> Is there a reason that BuildElementAttribute isn?t derived from
> ElementNameAttribute.
>
Yes. they are performing different tasks. ElementNameAttribute is used
to associate an xml element name with a particular class thats being
used to model that element. BuildElementAttribute indicates that the
current property models a child element in the build file and gives the
name of that element. When NAnt starts up it scans all relevent
assemblies for classes with ElementNameAttribute 's and essentially
builds a lookup table mapping element name to class. Then when
tasks/elements are being loaded from the build file the
BuildElementAttributes are used to know what child elements to select
from the build file ( using xpath ).
If you look thru the source you'll see that this isn't *quite* true - on
startup it looks for TaskNameAttribute's not ElementNameAttribute 's -
thats because I haven't finished generalising all that code. Now that
you remind me I should get that done pretty soon.
you'll notice also that ElementNameAttribute is only relevant on class
declarations while BuildElementAttribute applies to Property
declarations. Having one derive from the other really wouldn't make much
sense.
I hope this clarifies things
Ian
> It seems like they both define named Element nodes, the former being
> handled in a more specialized way in the Element InitializeAttributes
> method.
>
> Thanks,
>
> Scott
>
> PS. I tried looking in the archives, but found sourceforge?s archive
> viewer horrible. I have since subscribed this list on
> www.mail-archive.com <http://www.mail-archive.com/> . This is
> searchable?
> http://www.mail-archive.com/nant-developers%40lists.sourceforge.net
>
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers