[Mono-bugs] [Bug 493143] New: SettingsProviderAttribute does not work if applied to class

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Apr 8 04:23:51 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=493143


           Summary: SettingsProviderAttribute does not work if applied to
                    class
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86
        OS/Version: Windows Vista
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Configuration
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: rickard.b.granberg at ericsson.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User


Using the SettingsProviderAttribute to provide a custom SettingsProvider does
not work when applied to the class, only when applied to a property of a class:

In the below example, MySettingsProvider is used
when reading the SomeFlag property from the config-file:

public class AppSettings : ApplicationSettingsBase
{
  [UserScopedSettings()]
  [SettingsProvider(typeof(MySettingsProvider))]
  public property bool SomeFlag
  {
    get
    {
      return (bool)this["SomeFlag"];
    }
    set
    {
      this["SomeFlag"] = value;
    }
  }
}

In MS.Net, you can apply the attribute to the class
to make valid for all properties in that class

In the below example, MySettingsProvider is not used
when reading the SomeFlag property from the config-file

[SettingsProvider(typeof(MySettingsProvider))]
public class AppSettings : ApplicationSettingsBase
{
  [UserScopedSettings()]
  public property bool SomeFlag
  {
    get
    {
      return (bool)this["SomeFlag"];
    }
    set
    {
      this["SomeFlag"] = value;
    }
  }
}

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list