usingSystem;usingSystem.Configuration;usingEmpi.Camino.Data.Retailer;usingSystem.Linq;usingEmpi.Camino.Data;namespaceEmpi.Camino.Configuration{classCaminoSettingsProvider:SettingsProvider{publicoverridestringApplicationName{get{return(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);}set{thrownewNotImplementedException();}}publicoverrideSettingsPropertyValueCollectionGetPropertyValues(SettingsContextcontext,SettingsPropertyCollectioncollection){SettingsPropertyValueCollectionsettingsPropertyValueCollection=newSettingsPropertyValueCollection();//MP:should operate on a more Common RepositoryName RepositoryBase<Empi.Camino.Data.IConfigurationBase>retailerDataConfiguration=RepositoryFactory.GetCachedRetailerDataRepository<Empi.Camino.Data.IConfigurationBase>();foreach(SettingsPropertysettingsPropertyincollection){//MP: DataContextFactory should also be appliedvarconf=retailerDataConfiguration.SingleOrDefault(c=>c.Key==settingsProperty.Name,(Type)context["ConfigurationTableType"]);if(conf!=null){varsettpropvalue=newSettingsPropertyValue(settingsProperty);settpropvalue.SerializedValue=conf.Value;settingsPropertyValueCollection.Add(settpropvalue);}}returnsettingsPropertyValueCollection;}publicoverridevoidSetPropertyValues(SettingsContextcontext,SettingsPropertyValueCollectioncollection){//MP:should operate on a more Common RepositoryNameRepositoryBase<Empi.Camino.Data.IConfigurationBase>retailerDataConfiguration=RepositoryFactory.GetCachedRetailerDataRepository<Empi.Camino.Data.IConfigurationBase>();foreach(varsettingsPropertyValueinfromitemincollection.Cast<SettingsPropertyValue>()whereitem.IsDirtyselectitem){//MP: DataContextFactory should also be appliedvarconf=retailerDataConfiguration.SingleOrDefault(c=>c.Key==settingsPropertyValue.Name,(Type)context["ConfigurationTableType"]);if(conf!=null){conf.Value=settingsPropertyValue.SerializedValue.ToString();}else{Empi.Camino.Data.IConfigurationBasepropValue=retailerDataConfiguration.CreateInstance((Type)context["ConfigurationTableType"]);propValue.Key=settingsPropertyValue.Name;propValue.Value=settingsPropertyValue.SerializedValue.ToString();}}retailerDataConfiguration.SaveAll();}}}