/// <summary> /// Creates a new <see cref="RestierConventionEntitySetDefinition"/> instance. /// </summary> /// <param name="name"></param> /// <param name="pipelineState"></param> /// <param name="entitySetName"></param> /// <param name="entitySetOperation"></param> internal RestierConventionEntitySetDefinition(string name, RestierPipelineState pipelineState, string entitySetName, RestierEntitySetOperation entitySetOperation) : base(name, pipelineState) { EntitySetName = entitySetName; EntitySetOperation = entitySetOperation; }
/// <summary> /// Generates the complete MethodName for a given <see cref="IEdmOperationImport"/>, <see cref="RestierPipelineState"/>, and <see cref="RestierEntitySetOperation"/>. /// </summary> /// <param name="entitySet">The <see cref="IEdmEntitySet"/> that contains the details for the EntitySet and the Entities it holds.</param> /// <param name="restierPipelineState">The part of the Restier pipeline currently executing.</param> /// <param name="operation">The <see cref="RestierEntitySetOperation"/> currently being executed.</param> /// <returns>A string representing the fully-realized MethodName.</returns> /// <returns></returns> public static string GetEntitySetMethodName(IEdmEntitySet entitySet, RestierPipelineState restierPipelineState, RestierEntitySetOperation operation) { if (entitySet == null || (operation == RestierEntitySetOperation.Filter && ExcludedFilterStates.Contains(restierPipelineState)) || restierPipelineState == RestierPipelineState.Submit && ExcludedEntitySetSubmitOperations.Contains(operation)) { return(string.Empty); } var prefix = GetPipelinePrefixInternal(restierPipelineState); //RWM: If, for some reason, we don't have a prefix, then we don't have a method for this operation. So don't do anything. if (string.IsNullOrWhiteSpace(prefix)) { return(string.Empty); } var operationName = GetRestierOperationNameInternal(operation, restierPipelineState); var suffix = operation != RestierEntitySetOperation.Filter ? GetPipelineSuffixInternal(restierPipelineState) : string.Empty; var entityReferenceName = GetEntityReferenceNameInternal(operation, entitySet); return($"{prefix}{operationName}{suffix}{entityReferenceName}"); }
/// <summary> /// Generates the right EntityName reference for a given Operation. /// </summary> /// <param name="operation">The <see cref="RestierEntitySetOperation"/> to determine the Entity name for.</param> /// <param name="entitySetName">The <see cref="string"/> that contains the name of the EntitySet.</param> /// <param name="entityTypeName">The <see cref="string"/> that contains the name of the Entity type.</param> /// <returns>A string representing the right EntityName reference for a given Operation.</returns> internal static string GetEntityReferenceNameInternal(RestierEntitySetOperation operation, string entitySetName, string entityTypeName) { //RWM: You filter a set, but you Insert/Update/Delete individual items. return(operation == RestierEntitySetOperation.Filter ? entitySetName : entityTypeName); }
/// <summary> /// Generates the right OperationName string for a given <see cref="RestierEntitySetOperation"/> and <see cref="RestierPipelineState"/>. /// </summary> /// <param name="operation">The <see cref="RestierEntitySetOperation"/> to determine the method name for.</param> /// <param name="restierPipelineState">The <see cref="RestierPipelineState"/> to determine the method name for.</param> /// <returns>A string containing the corrected OperationName, accounting for what the suffix will end up being.</returns> internal static string GetRestierOperationNameInternal(RestierEntitySetOperation operation, RestierPipelineState restierPipelineState) { return(GetRestierOperationNameInternal(operation.ToString(), restierPipelineState)); }
/// <summary> /// Generates the right EntityName reference for a given Operation. /// </summary> /// <param name="operation">The <see cref="RestierEntitySetOperation"/> to determine the Entity name for.</param> /// <param name="entitySet">The <see cref="IEdmEntitySet"/> that contains the details for the EntitySet and the Entities it holds.</param> /// <returns>A string representing the right EntityName reference for a given Operation.</returns> internal static string GetEntityReferenceNameInternal(RestierEntitySetOperation operation, IEdmEntitySet entitySet) { //RWM: You filter a set, but you Insert/Update/Delete individual items. return(GetEntityReferenceNameInternal(operation, entitySet.Name, entitySet.EntityType().Name)); }