//private U Execute<T, U>(T model, ICriterion criterion, IRequestContext requestContext) where T : class, new() //{ // U result = default(U); // var implementor = ResolveImplementor<T>(ModelActionOption.Execute, requestContext, null, criterion); // if (implementor != null) // { // IContext context = requestContext as IContext; // result = implementor.Execute<U>(model, criterion, context); // } // return result; //} #endregion // string s = context.GetValue<string>(XFConstants.Context.Application); private string ResolveDbKey <T>(IContext context) where T : class, new() { string key = DatabaseKeyResolver.Resolve <T>(context); if (String.IsNullOrWhiteSpace(key) && !String.IsNullOrWhiteSpace(eXtensibleConfig.ConnectionStringKey)) { key = eXtensibleConfig.ConnectionStringKey; } if (eXtensibleConfig.Inform) { EventWriter.Inform(String.Format("database key resolved to {0}", key)); } return(key); }
public static IConfigStrategyResolver Load(string sectionGroupName) { IConfigStrategyResolver resolver = new DatabaseKeyResolver(); string filepath = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; var fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = filepath }; Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); eXtensibleStrategySectionGroup group = config.SectionGroups[sectionGroupName] as eXtensibleStrategySectionGroup; resolver.Initialize(group); if (eXtensibleConfig.Inform) { EventWriter.Inform("DatabaseKeyResolver loaded"); } return(resolver); }