Ejemplo n.º 1
0
 private static T ComputeChainedValue <T>(SettingsContextBase firstContext, Func <SettingsContextBase, T> valueGetter)
 {
     for (SettingsContextBase settingsContextBase = firstContext; settingsContextBase != null; settingsContextBase = settingsContextBase.NextContext)
     {
         T t = valueGetter(settingsContextBase);
         if (t != null && !t.Equals(default(T)))
         {
             return(t);
         }
     }
     return(default(T));
 }
Ejemplo n.º 2
0
 public static IDisposable ActivateContext(ISettingsContextProvider provider)
 {
     if (provider != null)
     {
         SettingsContextBase settingsContextBase = provider.GetSettingsContext() as SettingsContextBase;
         if (settingsContextBase != null)
         {
             return(settingsContextBase.Activate());
         }
     }
     return(null);
 }
Ejemplo n.º 3
0
 public GenericSettingsContext(string propertyName, string propertyValue, SettingsContextBase nextContext = null) : base(nextContext)
 {
     this.propertyName  = propertyName;
     this.propertyValue = propertyValue;
 }
 public SimpleDatabaseSettingsContext(Guid mdbGuid, SettingsContextBase nextContext = null) : base(nextContext)
 {
     this.mdbGuid = mdbGuid;
 }
Ejemplo n.º 5
0
            private static T ComputeInheritedValue <T>(Func <SettingsContextBase, T> valueGetter)
            {
                for (SettingsContextBase.NestedContext nestedContext = SettingsContextBase.NestedContext.Current; nestedContext != null; nestedContext = nestedContext.ParentContext)
                {
                    T t = SettingsContextBase.EffectiveContextObject.ComputeChainedValue <T>(nestedContext.Context, valueGetter);
                    if (t != null && !t.Equals(default(T)))
                    {
                        return(t);
                    }
                }
                ISettingsContext settingsContext = (SettingsContextBase.DefaultContextGetter != null) ? SettingsContextBase.DefaultContextGetter() : null;

                return(SettingsContextBase.EffectiveContextObject.ComputeChainedValue <T>(settingsContext as SettingsContextBase, valueGetter));
            }
Ejemplo n.º 6
0
 public NestedContext(SettingsContextBase context)
 {
     this.Context       = context;
     this.ParentContext = SettingsContextBase.NestedContext.current;
     SettingsContextBase.NestedContext.current = this;
 }
Ejemplo n.º 7
0
 public SettingsContextBase(SettingsContextBase nextContext)
 {
     this.HashableIdentity = Guid.NewGuid().ToString();
     this.NextContext      = nextContext;
 }
Ejemplo n.º 8
0
 public MailboxSettingsContext(Guid mailboxGuid, SettingsContextBase nextContext = null) : base(nextContext)
 {
     this.mailboxGuid = mailboxGuid;
 }