All pastes #264026 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-12-02 00:33 UTC
rendered paste body
Index: ProviderBase.cs
===================================================================
--- ProviderBase.cs     (revision 68842)
+++ ProviderBase.cs     (working copy)
@@ -36,12 +36,22 @@
 {
        public abstract class ProviderBase
        {
+               bool alreadyInitialized;
+               
                protected ProviderBase ()
                {
                }
                
                public virtual void Initialize (string name, NameValueCollection config)
                {
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
+                       if (name.Length == 0)
+                               throw new ArgumentException ("name must not be empty");
+                       if (alreadyInitialized)
+                               throw new InvalidOperation ("Provider has already been initialized");
+                       alreadyInitialized = true;
+                       
                        _name = name;
 
                        if (config != null)