public static AnnotationDVsManager Instance(string svcRootURL) { if (null == defaultValAccessor) { defaultValAccessor = new AnnotationDVsManager(svcRootURL); } return defaultValAccessor; }
/// <summary> /// Creates an instance of ServiceContext. /// </summary> /// <param name="destination">request Uri of the service context</param> /// <param name="jobId">Job identifier</param> /// <param name="statusCode">Http status code of the response</param> /// <param name="responseHttpHeaders">Header text of the response</param> /// <param name="responsePayload">Payload content of the response</param> /// <param name="entityType">Fully-qualified name of entity type the repsonse payload is about</param> /// <param name="serviceBaseUri">Uri of service document</param> /// <param name="serviceDocument">Content of service document</param> /// <param name="metadataDocument">Content of metadata document</param> /// <param name="offline">Flag of conetxt being offline(true) or live(false)</param> /// <param name="reqHeaders">Http headers used as part of header</param> /// <param name="odataMetadata">Odata metadata type</param> public ServiceContext( Uri destination, Guid jobId, HttpStatusCode?statusCode, string responseHttpHeaders, string responsePayload, string entityType, Uri serviceBaseUri, string serviceDocument, string metadataDocument, bool offline, IEnumerable <KeyValuePair <string, string> > reqHeaders, ODataMetadataType odataMetadata = ODataMetadataType.MinOnly, string jsonFullmetadataPayload = null, string category = "core") { if (destination == null) { throw new ArgumentNullException("destination"); } // TODO: uncomment this to enable uri canonicalization // this.Destination = destination.Canonicalize(); this.Destination = destination; this.DestinationBasePath = this.Destination.GetLeftPart(UriPartial.Path).TrimEnd('/'); AnnotationDVsManager.Instance(this.DestinationBasePath); if (!string.IsNullOrEmpty(this.DestinationBasePath)) { string lastLeg = this.DestinationBasePath.Substring(this.DestinationBasePath.LastIndexOf('/')); if (!string.IsNullOrEmpty(lastLeg)) { this.DestinationBaseLastSegment = lastLeg.TrimStart('/'); } } this.Projection = this.Destination.Query.IndexOf("$select=", StringComparison.OrdinalIgnoreCase) >= 0; this.JobId = jobId; this.HttpStatusCode = statusCode; this.ResponseHttpHeaders = responseHttpHeaders; this.OdataMetadataType = odataMetadata; this.JsonFullMetadataPayload = jsonFullmetadataPayload; this.MetadataDocument = metadataDocument; int test = responsePayload.Length; this.ResponsePayload = responsePayload; this.EntityTypeFullName = entityType; this.ServiceBaseUri = serviceBaseUri; this.ServiceDocument = serviceDocument; this.IsOffline = offline; this.RequestHeaders = reqHeaders; this.Category = category; this.ServiceType = ConformanceServiceType.ReadWrite; this.LevelTypes = new ConformanceLevelType[] { ConformanceLevelType.Minimal }; if (category.Contains(";")) { string[] array = category.Split(';'); this.Category = array[0]; this.ServiceType = (ConformanceServiceType)Enum.Parse(typeof(ConformanceServiceType), array[1]); if (array.Length > 2 && array[2].Contains(",")) { string[] levelArray = array[2].Split(','); this.LevelTypes = new ConformanceLevelType[levelArray.Length]; for (int i = 0; i < levelArray.Length; i++) { ConformanceLevelType level; if (Enum.TryParse(levelArray[i], out level)) { this.LevelTypes[i] = level; } } } } }