/// <summary> /// biz.dfch.CS.Appclusive.Api.Core.Core /// </summary> internal biz.dfch.CS.Appclusive.Api.Core.Core CoreRepositoryGet() { biz.dfch.CS.Appclusive.Api.Core.Core coreRepository = new biz.dfch.CS.Appclusive.Api.Core.Core(new Uri(Properties.Settings.Default.AppclusiveApiBaseUrl + "Core")); coreRepository.IgnoreMissingProperties = true; coreRepository.Format.UseJson(); coreRepository.SaveChangesDefaultOptions = SaveChangesOptions.PatchOnUpdate; coreRepository.MergeOption = MergeOption.PreserveChanges; System.Net.NetworkCredential apiCreds = HttpContext.Current.Session["LoginData"] as System.Net.NetworkCredential; Contract.Assert(null != apiCreds); coreRepository.Credentials = apiCreds; return coreRepository; }
public AppclusiveEndpoints(Uri baseUri, ICredentials credential) { Contract.Requires(null != baseUri); Contract.Requires(baseUri.IsAbsoluteUri); Contract.Ensures(null != Diagnostics); Contract.Ensures(null != Core); Contract.Ensures(null != Infrastructure); Contract.Ensures(null != Csm); Contract.Ensures(null != Cmp); credential = credential ?? CredentialCache.DefaultNetworkCredentials; Trace.WriteLine("Initialising Appclusive endpoints from '{0}' ...", baseUri.AbsoluteUri, ""); Uri uri; uri = new Uri(string.Format("{0}/Diagnostics", baseUri.AbsoluteUri.TrimEnd('/'))); Diagnostics = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(uri); Diagnostics.Credentials = credential; Diagnostics.Format.UseJson(); uri = new Uri(string.Format("{0}/Core", baseUri.AbsoluteUri.TrimEnd('/'))); Core = new biz.dfch.CS.Appclusive.Api.Core.Core(uri); Core.Credentials = credential; Core.Format.UseJson(); uri = new Uri(string.Format("{0}/Infrastructure", baseUri.AbsoluteUri.TrimEnd('/'))); Infrastructure = new biz.dfch.CS.Appclusive.Api.Infrastructure.Infrastructure(uri); Infrastructure.Credentials = credential; Infrastructure.Format.UseJson(); uri = new Uri(string.Format("{0}/Csm", baseUri.AbsoluteUri.TrimEnd('/'))); Csm = new biz.dfch.CS.Appclusive.Api.Csm.Csm(uri); Csm.Credentials = credential; Csm.Format.UseJson(); uri = new Uri(string.Format("{0}/Cmp", baseUri.AbsoluteUri.TrimEnd('/'))); Cmp = new biz.dfch.CS.Appclusive.Api.Cmp.Cmp(uri); Cmp.Credentials = credential; Cmp.Format.UseJson(); Trace.WriteLine("Initialising Appclusive endpoints from '{0}' COMPLETED.", baseUri.AbsoluteUri, ""); }