コード例 #1
0
        public static IByContextSettings AddFromXmlFile(this IByContextSettings source, string fileName)
        {
            source.AddConfigurationDataProvider(new ConvertFromSectionDataProvider(()=>
                new XmlLoader().LoadFile(fileName), source));

            return source;
        }
コード例 #2
0
        public static IByContextSettings AddFromRemoteWCFService(this IByContextSettings source)
        {
            source.AddConfigurationDataProvider(new ConvertFromSectionDataProvider(() =>
                {
                    IConfigurationDataService channel =
                        new ChannelFactory<IConfigurationDataService>("ConfigurationData").CreateChannel();
                    return channel.GetConfigurationData();
                },source)
                );

            return source;
        }
コード例 #3
0
        public static INConfigSettings AddFromCollection(this INConfigSettings settings,
                                                         MongoCollection<Section> collection)
        {
            if (!BsonClassMap.IsClassMapRegistered(typeof(Section)))
            {
                // Register Section in BsonClassMap to ignore automatically-added "_id" property
                BsonClassMap.RegisterClassMap<Section>(cm =>
                {
                    cm.AutoMap();
                    cm.SetIgnoreExtraElements(true);
                });
            }

            var provider = new ConvertFromSectionDataProvider(() => collection.FindAll().ToList(), settings);
            return settings.AddConfigurationDataProvider(provider);
        }
コード例 #4
0
 public static IByContextSettings AddFromRawXml(this IByContextSettings source, string rawXml)
 {
     source.AddConfigurationDataProvider(new ConvertFromSectionDataProvider(()=>
         new XmlLoader().ReadXml(rawXml), source));
     return source;
 }