Skip to content

Commit

Permalink
rename two classes
Browse files Browse the repository at this point in the history
  • Loading branch information
chinadragon0515 committed Aug 8, 2016
1 parent 178a06b commit a6db7ca
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ namespace Microsoft.Restier.Core
/// <summary>
/// A convention-based change set item processor which calls logic like OnInserting and OnInserted.
/// </summary>
internal class ConventionBasedChangeSetItemProcessor : IChangeSetItemProcessor
internal class ConventionBasedChangeSetItemFilter : IChangeSetItemFilter
{
private Type targetType;

private ConventionBasedChangeSetItemProcessor(Type targetType)
private ConventionBasedChangeSetItemFilter(Type targetType)
{
Ensure.NotNull(targetType, "targetType");
this.targetType = targetType;
Expand All @@ -32,12 +32,12 @@ public static void ApplyTo(
{
Ensure.NotNull(services, "services");
Ensure.NotNull(targetType, "targetType");
services.AddService<IChangeSetItemProcessor>(
(sp, next) => new ConventionBasedChangeSetItemProcessor(targetType));
services.AddService<IChangeSetItemFilter>(
(sp, next) => new ConventionBasedChangeSetItemFilter(targetType));
}

/// <inheritdoc/>
public Task OnProcessingChangeSetItemAsync(
public Task OnChangeSetItemProcessingAsync(
SubmitContext context,
ChangeSetItem item,
CancellationToken cancellationToken)
Expand All @@ -47,7 +47,7 @@ public Task OnProcessingChangeSetItemAsync(
}

/// <inheritdoc/>
public Task OnProcessedChangeSetItemAsync(
public Task OnChangeSetItemProcessedAsync(
SubmitContext context,
ChangeSetItem item,
CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace Microsoft.Restier.Core
/// <summary>
/// A convention-based change set item filter.
/// </summary>
internal class ConventionBasedOperationProcessor : IOperationProcessor
internal class ConventionBasedOperationFilter : IOperationFilter
{
private Type targetType;

private ConventionBasedOperationProcessor(Type targetType)
private ConventionBasedOperationFilter(Type targetType)
{
Ensure.NotNull(targetType, "targetType");
this.targetType = targetType;
Expand All @@ -31,12 +31,12 @@ public static void ApplyTo(
{
Ensure.NotNull(services, "services");
Ensure.NotNull(targetType, "targetType");
services.AddService<IOperationProcessor>(
(sp, next) => new ConventionBasedOperationProcessor(targetType));
services.AddService<IOperationFilter>(
(sp, next) => new ConventionBasedOperationFilter(targetType));
}

/// <inheritdoc/>
public Task OnExecutingOperationAsync(
public Task OnOperationExecutingAsync(
OperationContext context,
CancellationToken cancellationToken)
{
Expand All @@ -45,7 +45,7 @@ public Task OnExecutingOperationAsync(
}

/// <inheritdoc/>
public Task OnExecutedOperationAsync(
public Task OnOperationExecutedAsync(
OperationContext context,
CancellationToken cancellationToken)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Microsoft.Restier.Core/Microsoft.Restier.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
<DependentUpon>SharedResources.resx</DependentUpon>
</Compile>
<Compile Include="ApiConfiguratorAttributes.cs" />
<Compile Include="Conventions\ConventionBasedOperationProcessor.cs" />
<Compile Include="Conventions\ConventionBasedOperationFilter.cs" />
<Compile Include="Conventions\ConventionBasedOperationAuthorizer.cs" />
<Compile Include="Conventions\ConventionBasedChangeSetItemAuthorizer.cs" />
<Compile Include="Conventions\ConventionBasedChangeSetConstants.cs" />
<Compile Include="Conventions\ConventionBasedChangeSetItemProcessor.cs" />
<Compile Include="Conventions\ConventionBasedChangeSetItemFilter.cs" />
<Compile Include="Conventions\ConventionBasedChangeSetItemValidator.cs" />
<Compile Include="Conventions\ConventionBasedQueryExpressionProcessor.cs" />
<Compile Include="ApiBaseExtensions.cs" />
Expand All @@ -81,7 +81,7 @@
<Compile Include="InvocationContextExtensions.cs" />
<Compile Include="Model\EdmHelpers.cs" />
<Compile Include="Model\ModelContext.cs" />
<Compile Include="Operation\IOperationProcessor.cs" />
<Compile Include="Operation\IOperationFilter.cs" />
<Compile Include="Operation\IOperationAuthorizer.cs" />
<Compile Include="Operation\IOperationExecutor.cs" />
<Compile Include="Operation\OperationContext.cs" />
Expand Down Expand Up @@ -112,7 +112,7 @@
<Compile Include="Submit\ChangeSetItem.cs" />
<Compile Include="Submit\DefaultSubmitHandler.cs" />
<Compile Include="Submit\IChangeSetItemAuthorizer.cs" />
<Compile Include="Submit\IChangeSetItemProcessor.cs" />
<Compile Include="Submit\IChangeSetItemFilter.cs" />
<Compile Include="Submit\IChangeSetItemValidator.cs" />
<Compile Include="Submit\IChangeSetInitializer.cs" />
<Compile Include="Submit\ISubmitExecutor.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.Restier.Core.Operation
/// <summary>
/// Represents a operation processor.
/// </summary>
public interface IOperationProcessor
public interface IOperationFilter
{
/// <summary>
/// Asynchronously applies logic before a operation is executed.
Expand All @@ -23,7 +23,7 @@ public interface IOperationProcessor
/// <returns>
/// A task that represents the asynchronous operation.
/// </returns>
Task OnExecutingOperationAsync(
Task OnOperationExecutingAsync(
OperationContext context,
CancellationToken cancellationToken);

Expand All @@ -39,7 +39,7 @@ Task OnExecutingOperationAsync(
/// <returns>
/// A task that represents the asynchronous operation.
/// </returns>
Task OnExecutedOperationAsync(
Task OnOperationExecutedAsync(
OperationContext context,
CancellationToken cancellationToken);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.Restier.Core/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ public static IServiceCollection AddConventionBasedServices(this IServiceCollect
Ensure.NotNull(apiType, "apiType");

ConventionBasedChangeSetItemAuthorizer.ApplyTo(services, apiType);
ConventionBasedChangeSetItemProcessor.ApplyTo(services, apiType);
ConventionBasedChangeSetItemFilter.ApplyTo(services, apiType);
services.AddService<IChangeSetItemValidator, ConventionBasedChangeSetItemValidator>();
ConventionBasedQueryExpressionProcessor.ApplyTo(services, apiType);
ConventionBasedOperationAuthorizer.ApplyTo(services, apiType);
ConventionBasedOperationProcessor.ApplyTo(services, apiType);
ConventionBasedOperationFilter.ApplyTo(services, apiType);
return services;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Microsoft.Restier.Core/Submit/DefaultSubmitHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ private static async Task PerformPreEvent(
{
item.ChangeSetItemProcessingStage = ChangeSetItemProcessingStage.PreEventing;

var processor = context.GetApiService<IChangeSetItemProcessor>();
var processor = context.GetApiService<IChangeSetItemFilter>();
if (processor != null)
{
await processor.OnProcessingChangeSetItemAsync(context, item, cancellationToken);
await processor.OnChangeSetItemProcessingAsync(context, item, cancellationToken);
}

if (item.ChangeSetItemProcessingStage == ChangeSetItemProcessingStage.PreEventing)
Expand Down Expand Up @@ -229,10 +229,10 @@ private static async Task PerformPostEvent(
{
foreach (ChangeSetItem item in changeSetItems)
{
var processor = context.GetApiService<IChangeSetItemProcessor>();
var processor = context.GetApiService<IChangeSetItemFilter>();
if (processor != null)
{
await processor.OnProcessedChangeSetItemAsync(context, item, cancellationToken);
await processor.OnChangeSetItemProcessedAsync(context, item, cancellationToken);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
namespace Microsoft.Restier.Core.Submit
{
/// <summary>
/// Represents a change set item processor.
/// Represents a change set item filter to have logic before and after change set item processed.
/// </summary>
public interface IChangeSetItemProcessor
public interface IChangeSetItemFilter
{
/// <summary>
/// Asynchronously applies logic before a change set item is processed.
Expand All @@ -26,7 +26,7 @@ public interface IChangeSetItemProcessor
/// <returns>
/// A task that represents the asynchronous operation.
/// </returns>
Task OnProcessingChangeSetItemAsync(
Task OnChangeSetItemProcessingAsync(
SubmitContext context,
ChangeSetItem item,
CancellationToken cancellationToken);
Expand All @@ -46,7 +46,7 @@ Task OnProcessingChangeSetItemAsync(
/// <returns>
/// A task that represents the asynchronous operation.
/// </returns>
Task OnProcessedChangeSetItemAsync(
Task OnChangeSetItemProcessedAsync(
SubmitContext context,
ChangeSetItem item,
CancellationToken cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,19 @@ private static async Task InvokeAuthorizers(

private static void PerformPreEvent(OperationContext context, CancellationToken cancellationToken)
{
var processor = context.GetApiService<IOperationProcessor>();
var processor = context.GetApiService<IOperationFilter>();
if (processor != null)
{
processor.OnExecutingOperationAsync(context, cancellationToken);
processor.OnOperationExecutingAsync(context, cancellationToken);
}
}

private static void PerformPostEvent(OperationContext context, CancellationToken cancellationToken)
{
var processor = context.GetApiService<IOperationProcessor>();
var processor = context.GetApiService<IOperationFilter>();
if (processor != null)
{
processor.OnExecutedOperationAsync(context, cancellationToken);
processor.OnOperationExecutedAsync(context, cancellationToken);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions test/Microsoft.Restier.TestCommon/PublicApi.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ public interface Microsoft.Restier.Core.Operation.IOperationExecutor {
System.Threading.Tasks.Task`1[[System.Linq.IQueryable]] ExecuteOperationAsync (object instanceImplementMethod, Microsoft.Restier.Core.Operation.OperationContext context, System.Threading.CancellationToken cancellationToken)
}

public interface Microsoft.Restier.Core.Operation.IOperationProcessor {
System.Threading.Tasks.Task OnExecutedOperationAsync (Microsoft.Restier.Core.Operation.OperationContext context, System.Threading.CancellationToken cancellationToken)
System.Threading.Tasks.Task OnExecutingOperationAsync (Microsoft.Restier.Core.Operation.OperationContext context, System.Threading.CancellationToken cancellationToken)
public interface Microsoft.Restier.Core.Operation.IOperationFilter {
System.Threading.Tasks.Task OnOperationExecutedAsync (Microsoft.Restier.Core.Operation.OperationContext context, System.Threading.CancellationToken cancellationToken)
System.Threading.Tasks.Task OnOperationExecutingAsync (Microsoft.Restier.Core.Operation.OperationContext context, System.Threading.CancellationToken cancellationToken)
}

public class Microsoft.Restier.Core.Operation.OperationContext : Microsoft.Restier.Core.InvocationContext {
Expand Down Expand Up @@ -447,9 +447,9 @@ public interface Microsoft.Restier.Core.Submit.IChangeSetItemAuthorizer {
System.Threading.Tasks.Task`1[[System.Boolean]] AuthorizeAsync (Microsoft.Restier.Core.Submit.SubmitContext context, Microsoft.Restier.Core.Submit.ChangeSetItem item, System.Threading.CancellationToken cancellationToken)
}

public interface Microsoft.Restier.Core.Submit.IChangeSetItemProcessor {
System.Threading.Tasks.Task OnProcessedChangeSetItemAsync (Microsoft.Restier.Core.Submit.SubmitContext context, Microsoft.Restier.Core.Submit.ChangeSetItem item, System.Threading.CancellationToken cancellationToken)
System.Threading.Tasks.Task OnProcessingChangeSetItemAsync (Microsoft.Restier.Core.Submit.SubmitContext context, Microsoft.Restier.Core.Submit.ChangeSetItem item, System.Threading.CancellationToken cancellationToken)
public interface Microsoft.Restier.Core.Submit.IChangeSetItemFilter {
System.Threading.Tasks.Task OnChangeSetItemProcessedAsync (Microsoft.Restier.Core.Submit.SubmitContext context, Microsoft.Restier.Core.Submit.ChangeSetItem item, System.Threading.CancellationToken cancellationToken)
System.Threading.Tasks.Task OnChangeSetItemProcessingAsync (Microsoft.Restier.Core.Submit.SubmitContext context, Microsoft.Restier.Core.Submit.ChangeSetItem item, System.Threading.CancellationToken cancellationToken)
}

public interface Microsoft.Restier.Core.Submit.IChangeSetItemValidator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services)
.AddSingleton<ODataPayloadValueConverter, CustomizedPayloadValueConverter>()
.AddSingleton<ODataValidationSettings>(validationSettingFactory)
.AddSingleton<IODataPathHandler, PathAndSlashEscapeODataPathHandler>()
.AddService<IChangeSetItemProcessor, CustomizedSubmitProcessor>()
.AddService<IChangeSetItemFilter, CustomizedSubmitFilter>()
.AddService<IModelBuilder, TrippinModelCustomizer>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

namespace Microsoft.OData.Service.Sample.Trippin.Extension
{
public class CustomizedSubmitProcessor : IChangeSetItemProcessor
public class CustomizedSubmitFilter : IChangeSetItemFilter
{
private IChangeSetItemProcessor Inner { get; set; }
private IChangeSetItemFilter Inner { get; set; }

public Task OnProcessingChangeSetItemAsync(SubmitContext context, ChangeSetItem item, CancellationToken cancellationToken)
public Task OnChangeSetItemProcessingAsync(SubmitContext context, ChangeSetItem item, CancellationToken cancellationToken)
{
return Inner.OnProcessingChangeSetItemAsync(context, item, cancellationToken);
return Inner.OnChangeSetItemProcessingAsync(context, item, cancellationToken);
}

public Task OnProcessedChangeSetItemAsync(SubmitContext context, ChangeSetItem item, CancellationToken cancellationToken)
public Task OnChangeSetItemProcessedAsync(SubmitContext context, ChangeSetItem item, CancellationToken cancellationToken)
{
var dataModificationItem = item as DataModificationItem;
if (dataModificationItem != null)
Expand Down Expand Up @@ -61,7 +61,7 @@ public Task OnProcessedChangeSetItemAsync(SubmitContext context, ChangeSetItem i
// Key is defined based on convention
}
}
return Inner.OnProcessedChangeSetItemAsync(context, item, cancellationToken);
return Inner.OnChangeSetItemProcessedAsync(context, item, cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<Compile Include="Models\TrippinModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Extension\CustomizedPayloadValueConverter.cs" />
<Compile Include="Extension\CustomizedSubmitProcessor.cs" />
<Compile Include="Extension\CustomizedSubmitFilter.cs" />
<Compile Include="Extension\PathAndSlashEscapeODataPathHandler.cs" />
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit a6db7ca

Please sign in to comment.