public SiteConfiguration(HttpContextBase httpContext) { var serializer = new JavaScriptSerializer(); var request = serializer.Deserialize<HubRequest>(httpContext.Request["data"]); using (var db = new KuduContext()) { var application = db.Applications.Find(request.State.AppName); ServiceUrl = application.ServiceUrl; SiteUrl = application.SiteUrl; Name = application.Name; Slug = application.Slug; UniqueId = application.UniqueId; ISiteConfiguration config; if (_cache.TryGetValue(UniqueId, out config)) { Repository = config.Repository; FileSystem = config.FileSystem; DeploymentManager = config.DeploymentManager; RepositoryManager = config.RepositoryManager; } else { Repository = new RemoteRepository(ServiceUrl + "scm"); FileSystem = new RemoteFileSystem(ServiceUrl + "files"); DeploymentManager = new RemoteDeploymentManager(ServiceUrl + "deploy"); RepositoryManager = new RemoteRepositoryManager(ServiceUrl + "scm"); DeploymentManager.StatusChanged += OnDeploymentStatusChanged; _cache[UniqueId] = this; } } }
private static IApplication GetApplication(IContext context) { var httpContext = context.Kernel.Get<HttpContextBase>(); string applicationName = ApplicationNameResolver.ResolveName(httpContext); using (var db = new KuduContext()) { return db.Applications.Find(applicationName); } }
private static IApplication GetApplication(IContext context) { var httpContext = context.Kernel.Get<HttpContextBase>(); var state = ClientStateResolver.GetState(httpContext); var applicationName = (string)state["applicationName"]; using (var db = new KuduContext()) { return db.Applications.Find(applicationName); } }
public ApplicationService(KuduContext db, ISiteManager siteManager) { _db = db; _siteManager = siteManager; }