// INTERNAL METHODS ///////////////////////////////////////////////// #region Methods internal IResourcePathContext CreateResourcePathContext(object clrResource) { if (clrResource == null) { throw new ArgumentNullException(nameof(clrResource), $"CLR resource object can not be null."); } if (_addPathActions != null) { foreach (var addPathAction in _addPathActions) { addPathAction(this, clrResource); } } this.EnsureBasePathsExist(); var clrResourceType = this.ClrResourceType; var resourceType = this.ServiceModel.GetResourceType(clrResourceType); var resourceSelfPathParts = CreateResourcePathParts(clrResourceType, resourceType, _resourceSelfBasePath, _resourceSelfPreviousRelationship); var resourceSelfBasePath = resourceSelfPathParts.Item1; var resourceSelfPathMode = resourceSelfPathParts.Item2; var resourceCanonicalPathParts = CreateResourcePathParts(clrResourceType, resourceType, _resourceCanonicalBasePath, _resourceCanonicalPreviousRelationship); var resourceCanonicalBasePath = resourceCanonicalPathParts.Item1; var resourceCanonicalPathMode = resourceCanonicalPathParts.Item2; var resourcePathContext = new ResourcePathContext(resourceSelfBasePath, resourceSelfPathMode, resourceCanonicalBasePath, resourceCanonicalPathMode); return(resourcePathContext); }
// INTERNAL METHODS ///////////////////////////////////////////////// #region Methods internal IResourcePathContext CreateResourcePathContext() { this.EnsureBasePathsExist(); var clrResourceType = typeof(TResource); var resourceType = this.ServiceModel.GetResourceType(clrResourceType); var resourceSelfPathParts = CreateResourcePathParts(clrResourceType, resourceType, this._resourceSelfBasePath, this._resourceSelfPreviousRelationship); var resourceSelfBasePath = resourceSelfPathParts.Item1; var resourceSelfPathMode = resourceSelfPathParts.Item2; var resourceCanonicalPathParts = CreateResourcePathParts(clrResourceType, resourceType, this._resourceCanonicalBasePath, this._resourceCanonicalPreviousRelationship); var resourceCanonicalBasePath = resourceCanonicalPathParts.Item1; var resourceCanonicalPathMode = resourceCanonicalPathParts.Item2; var resourcePathContext = new ResourcePathContext(resourceSelfBasePath, resourceSelfPathMode, resourceCanonicalBasePath, resourceCanonicalPathMode); return(resourcePathContext); }