In most cases you want to create your own list definition with your own event receiver that sould only react on events of your custom list.
SharePoint ships with alot of list definitions with unique list type numbers:
100: Generic list
101: Document library
104: Announcements list
and many more.
You can create event receivers that react on events of these list types.
To create a custom list definition you should use the visual studio template "List Definition" shipped with the VSeWSS 1.1. If you create a custom list with base type "document library" its id will also be 101. It's just a copy of the template you selected.
First line of schema.xml after creating the custom list definition project:
PLAIN TEXT
XML:
<List xmlns:ows="Microsoft SharePoint"
Title="List Definition1"
Direction="$Resources:Direction;"
Url="MyDocumentLibrary"
BaseType="1"
Name="MyDocumentLibrary"
Id="cc1b7796-28cb-4eeb-9ca5-fdacfadddecc"
Type="101"
xmlns="http://schemas.microsoft.com/sharepoint/">
So what you should do ist change the Type value to a non-used number:
PLAIN TEXT
XML:
<List xmlns:ows="Microsoft SharePoint"
Title="List Definition1"
Direction="$Resources:Direction;"
Url="MyDocumentLibrary"
BaseType="1"
Name="MyDocumentLibrary"
Id="cc1b7796-28cb-4eeb-9ca5-fdacfadddecc"
Type="999"
xmlns="http://schemas.microsoft.com/sharepoint/">
You also have to modify the ListDefinition.xml
PLAIN TEXT
XML:
<Elements
Id="cc1b7796-28cb-4eeb-9ca5-fdacfadddecc"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate
Name="BskhDocumentLibrary"
DisplayName="My Dokument Library"
Description="Custom document library with custom event receiver doing cool things."
BaseType="1"
Type="999"
OnQuickLaunch="TRUE"
SecurityBits="11"
Sequence="110"
Image="/_layouts/images/itdl.gif"
DocumentTemplate="101"
/>
</Elements>
and the ItemEvntReceiver.xml
PLAIN TEXT
XML:
<Elements
Id="faca01fe-8478-4116-8b72-1e243bda6268"
xmlns="http://schemas.microsoft.com/sharepoint/">
<Receivers
ListTemplateOwner="cc1b7796-28cb-4eeb-9ca5-fdacfadddecc"
ListTemplateId="999">
<Receiver>
<Name>ItemDeleted</Name>
<Type>ItemDeleted</Type>
<SequenceNumber>1</SequenceNumber>
<Class>faca01fe-8478-4116-8b72-1e243bda6268</Class>
</Receiver>
<Receiver>
<Name>ItemAdded</Name>
<Type>ItemAdded</Type>
<SequenceNumber>1</SequenceNumber>
<Class>faca01fe-8478-4116-8b72-1e243bda6268</Class>
</Receiver>
<Receiver>
<Name>ItemUpdated</Name>
<Type>ItemUpdated</Type>
<SequenceNumber>1</SequenceNumber>
<Class>faca01fe-8478-4116-8b72-1e243bda6268</Class>
</Receiver>
</Receivers>
</Elements>
Now your event receiver will be called only by MyDocumentLibrary lists and no longer by all document libraries.