コード例 #1
0
        public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection collection)
        {
            string userName = (string)context["UserName"];

            var propertyValues = collection.Cast<SettingsProperty>()
                                           .Select(p => new SettingsPropertyValue(p))
                                           .ToArray();

            if (repository.ContainsKey(userName))
            {
                var userProperties = repository[userName];

                foreach (var pv in propertyValues)
                    pv.PropertyValue = userProperties[pv.Name];
            }

            var result = new SettingsPropertyValueCollection();
            foreach (var pv in propertyValues)
                result.Add(pv);

            return result;
        }
コード例 #2
0
 private bool DoesNotContainDefaultColumns(SettingsPropertyCollection collection)
 {
     return
         !collection.Cast<SettingsProperty>()
                    .Any(
                        value =>
                        string.Compare(
                            value.Name, this.membershipProvider.UserIdColumn, StringComparison.OrdinalIgnoreCase)
                        == 0
                        || string.Compare(
                            value.Name, 
                            this.membershipProvider.UserEmailColumn, 
                            StringComparison.OrdinalIgnoreCase) == 0);
 }