public IDtoRootUrlStore SetPrimaryRootUrlStore(string RootUrl) { RootUrl = StringSupport.ToLowerFast(RootUrl.StripHttp()); _ServiceBaseUrl ExsistingPrimaryRootURL = this.GetPrimaryPyro_RootUrlStore(); if (ExsistingPrimaryRootURL != null) { ExsistingPrimaryRootURL.IsServersPrimaryUrlRoot = false; } _ServiceBaseUrl ExsistingNonPrimaryRootURL = this.GetPyro_RootUrlStore(RootUrl); if (ExsistingNonPrimaryRootURL != null) { ExsistingNonPrimaryRootURL.IsServersPrimaryUrlRoot = true; } else { _ServiceBaseUrl Pyro_RootUrlStore = new _ServiceBaseUrl(); Pyro_RootUrlStore.IsServersPrimaryUrlRoot = true; Pyro_RootUrlStore.Url = RootUrl; IPyroDbContext.Set <_ServiceBaseUrl>().Add(Pyro_RootUrlStore); } this.Save(); return(this.GetPrimaryRootUrlStore()); }
public IDtoRootUrlStore GetPrimaryRootUrlStore() { IDtoRootUrlStore DtoRootUrlStore = null; _ServiceBaseUrl oServiceBaseUrl = GetPrimaryPyro_RootUrlStore(); if (oServiceBaseUrl != null) { DtoRootUrlStore = IDtoRootUrlStoreFactory.CreateDtoRootUrlStore(); DtoRootUrlStore.Id = oServiceBaseUrl.Id; DtoRootUrlStore.Url = oServiceBaseUrl.Url; DtoRootUrlStore.IsServersPrimaryUrlRoot = oServiceBaseUrl.IsServersPrimaryUrlRoot; } return(DtoRootUrlStore); }
/// <summary> /// Gets the ServiceBaseUrl Instance if found or creates a new instance if not found /// </summary> /// <param name="UrlString"></param> /// <returns></returns> public IDtoRootUrlStore GetAndOrAddService_RootUrlStore(string ServiceRootUrl) { IDtoRootUrlStore Pyro_RootUrlStore = this.GetPyro_RootUrlStore(ServiceRootUrl); if (Pyro_RootUrlStore == null) { var Pyro_RootUrlStoreDb = new _ServiceBaseUrl(); Pyro_RootUrlStoreDb.IsServersPrimaryUrlRoot = false; Pyro_RootUrlStoreDb.Url = StringSupport.ToLowerFast(ServiceRootUrl.StripHttp()); Pyro_RootUrlStoreDb = IPyroDbContext.Set <_ServiceBaseUrl>().Add(Pyro_RootUrlStoreDb); this.Save(); return(Pyro_RootUrlStoreDb); } else { return(Pyro_RootUrlStore); } }