private bool TryExecuteCrudRequest(string[] chunks, IHttpContext context, bool handled, string appName) { IRequest request = context.Request; IResponse response = context.Response; string connectionName; string methodName; string daoName; GetDaoInfo(chunks, out connectionName, out methodName, out daoName); DaoProxyRegistration daoProxyReg = null; connectionName = connectionName.ToLowerInvariant(); if (CommonDaoProxyRegistrations.ContainsKey(connectionName)) { daoProxyReg = CommonDaoProxyRegistrations[connectionName]; } else if (AppDaoProxyRegistrations.ContainsKey(appName)) { daoProxyReg = AppDaoProxyRegistrations[appName].Where(dpr => dpr.ContextName.Equals(connectionName)).FirstOrDefault(); } if (daoProxyReg != null) { Type daoType = daoProxyReg.ServiceProvider[daoName]; if (daoType != null) { if (daoProxyReg.Database == null) { RegisterDatabase(daoProxyReg); } DaoCrudResponseProvider responseProvider = new DaoCrudResponseProvider(daoProxyReg, context); CrudResponse crudResponse = responseProvider.Execute(); if (crudResponse.Success) { handled = true; SendResponse(response, crudResponse.ToJson()); } } } return(handled); }
public string Proxies(string appName, bool min = false) { StringBuilder result = new StringBuilder(); CommonDaoProxyRegistrations.Keys.Each(cx => { string ctorScript = min ? CommonDaoProxyRegistrations[cx].MinProxies.ToString() : CommonDaoProxyRegistrations[cx].Proxies.ToString(); result.AppendLine(";\r\n"); result.AppendLine(ctorScript); }); if (AppDaoProxyRegistrations.ContainsKey(appName)) { AppDaoProxyRegistrations[appName].Each((reg, i) => { string ctorScript = min ? AppDaoProxyRegistrations[appName][i].MinProxies.ToString() : AppDaoProxyRegistrations[appName][i].Proxies.ToString(); result.AppendLine(";\r\n"); result.AppendLine(ctorScript); }); } return(result.ToString()); }