diff --git a/src/GlobalSuppressions.cs b/src/GlobalSuppressions.cs index a8b1c1c1..e9653745 100644 --- a/src/GlobalSuppressions.cs +++ b/src/GlobalSuppressions.cs @@ -10,19 +10,16 @@ [assembly: SuppressMessage("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.Batch.RestierBatchChangeSetRequestItem.#DisposeResponses(System.Collections.Generic.IEnumerable`1)")] [assembly: SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Scope = "member", Target = "Microsoft.Restier.Core.ApiBase.#Dispose()", Justification = "Need to do some clean up before the virtual Dispose(disposing) method gets called.")] [assembly: SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification = "These assemblies are delay-signed.")] -[assembly: SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Scope = "member", Target = "Microsoft.Restier.Providers.EntityFramework.ModelProducer.#ProduceModelAsync(Microsoft.Restier.Core.Model.ModelContext,System.Threading.CancellationToken)")] [assembly: SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Scope = "type", Target = "Microsoft.Restier.Core.Submit.ChangeSetValidationResults")] [assembly: SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Scope = "type", Target = "Microsoft.Restier.Security.ApiPermission")] [assembly: SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Scope = "member", Target = "Microsoft.Restier.Core.Submit.ChangeSetEntry.#Type")] [assembly: SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Scope = "member", Target = "Microsoft.Restier.Core.Query.QueryModelReference.#Type")] -[assembly: SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "itemValue", Scope = "member", Target = "Microsoft.Restier.Core.Submit.DataModificationItem.#ApplyPredicate(System.Linq.Expressions.ParameterExpression,System.Linq.Expressions.Expression,System.Collections.Generic.KeyValuePair`2)")] [assembly: SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Scope = "member", Target = "Microsoft.Restier.Providers.EntityFramework.ModelProducer.#.cctor()")] [assembly: SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.RestierController`1.#GetQuery(System.Web.OData.Extensions.HttpRequestMessageProperties)", Justification = "Instance is disposed elsewhere")] [assembly: SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable", Scope = "type", Target = "Microsoft.Restier.Core.Submit.ChangeSetValidationException", Justification = "We do not intend to support serialization of this exception yet")] [assembly: SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly", Justification = "AssemblyInformationalVersion could be string.")] #region CA1004 Generic method with type parameter -[assembly: SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "Microsoft.Restier.Core.ApiConfiguration.#AddPublisherServices`1(System.Action`1)")] [assembly: SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "Microsoft.Restier.Core.Query.IQueryExecutor.#ExecuteExpressionAsync`1(Microsoft.Restier.Core.Query.QueryContext,System.Linq.IQueryProvider,System.Linq.Expressions.Expression,System.Threading.CancellationToken)")] [assembly: SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "Microsoft.Restier.Core.ServiceCollectionExtensions.#HasService`1(Microsoft.Extensions.DependencyInjection.IServiceCollection)")] [assembly: SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "Microsoft.Restier.Core.ServiceCollectionExtensions.#AddService`2(Microsoft.Extensions.DependencyInjection.IServiceCollection)")] @@ -110,7 +107,6 @@ [assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.Model.RestierModelExtender+ModelMapper.#ModelCache")] [assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.Model.RestierModelExtender+ModelMapper.#InnerModelMapper")] [assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.BaseResult.#EdmType")] -[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.BaseResult.#Api")] [assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.PropertyAttributes.#NoWritePermission")] [assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.PropertyAttributes.#NoReadPermission")] [assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.PropertyAttributes.#NoReadPermission")] diff --git a/src/Microsoft.Restier.Publishers.OData/RestierController.cs b/src/Microsoft.Restier.Publishers.OData/RestierController.cs index 5fc952ff..3805de69 100644 --- a/src/Microsoft.Restier.Publishers.OData/RestierController.cs +++ b/src/Microsoft.Restier.Publishers.OData/RestierController.cs @@ -428,13 +428,13 @@ private HttpResponseMessage CreateQueryResponse( { if (this.shouldReturnCount || this.shouldWriteRawValue) { - var rawResult = new RawResult(query, typeReference, this.Api); + var rawResult = new RawResult(query, typeReference); singleResult = rawResult; response = this.Request.CreateResponse(HttpStatusCode.OK, rawResult); } else { - var primitiveResult = new PrimitiveResult(query, typeReference, this.Api); + var primitiveResult = new PrimitiveResult(query, typeReference); singleResult = primitiveResult; response = this.Request.CreateResponse(HttpStatusCode.OK, primitiveResult); } @@ -442,7 +442,7 @@ private HttpResponseMessage CreateQueryResponse( if (typeReference.IsComplex()) { - var complexResult = new ComplexResult(query, typeReference, this.Api); + var complexResult = new ComplexResult(query, typeReference); singleResult = complexResult; response = this.Request.CreateResponse(HttpStatusCode.OK, complexResult); } @@ -451,13 +451,13 @@ private HttpResponseMessage CreateQueryResponse( { if (this.shouldWriteRawValue) { - var rawResult = new RawResult(query, typeReference, this.Api); + var rawResult = new RawResult(query, typeReference); singleResult = rawResult; response = this.Request.CreateResponse(HttpStatusCode.OK, rawResult); } else { - var enumResult = new EnumResult(query, typeReference, this.Api); + var enumResult = new EnumResult(query, typeReference); singleResult = enumResult; response = this.Request.CreateResponse(HttpStatusCode.OK, enumResult); } @@ -481,11 +481,11 @@ private HttpResponseMessage CreateQueryResponse( if (elementType.IsPrimitive() || elementType.IsEnum()) { return this.Request.CreateResponse( - HttpStatusCode.OK, new NonResourceCollectionResult(query, typeReference, this.Api)); + HttpStatusCode.OK, new NonResourceCollectionResult(query, typeReference)); } return this.Request.CreateResponse( - HttpStatusCode.OK, new ResourceSetResult(query, typeReference, this.Api)); + HttpStatusCode.OK, new ResourceSetResult(query, typeReference)); } var entityResult = query.SingleOrDefault(); @@ -640,12 +640,11 @@ private Task ExecuteOperationAsync( CancellationToken cancellationToken) { var executor = Api.GetApiService(); - var implementInstance = Api.GetApiService(); var context = new OperationContext( getParaValueFunc, operationName, - implementInstance, + Api, isFunction, bindingParameterValue, Request.GetRequestContainer()); diff --git a/src/Microsoft.Restier.Publishers.OData/Results/BaseCollectionResult.cs b/src/Microsoft.Restier.Publishers.OData/Results/BaseCollectionResult.cs index 4f051397..c2562072 100644 --- a/src/Microsoft.Restier.Publishers.OData/Results/BaseCollectionResult.cs +++ b/src/Microsoft.Restier.Publishers.OData/Results/BaseCollectionResult.cs @@ -18,9 +18,8 @@ internal abstract class BaseCollectionResult : BaseResult /// /// The query that returns a collection of objects. /// The EDM type reference of the objects. - /// The api instance where the action is executed. - protected BaseCollectionResult(IQueryable query, IEdmTypeReference edmType, ApiBase api) - : base(edmType, api) + protected BaseCollectionResult(IQueryable query, IEdmTypeReference edmType) + : base(edmType) { Ensure.NotNull(query, "query"); diff --git a/src/Microsoft.Restier.Publishers.OData/Results/BaseResult.cs b/src/Microsoft.Restier.Publishers.OData/Results/BaseResult.cs index b3ffd3bc..a8bf5cf2 100644 --- a/src/Microsoft.Restier.Publishers.OData/Results/BaseResult.cs +++ b/src/Microsoft.Restier.Publishers.OData/Results/BaseResult.cs @@ -18,14 +18,11 @@ internal abstract class BaseResult /// Initializes a new instance of the class. /// /// The EDM type reference of the OData result. - /// The api instance where the action is executed. - protected BaseResult(IEdmTypeReference edmType, ApiBase api) + protected BaseResult(IEdmTypeReference edmType) { Ensure.NotNull(edmType, "edmType"); - Ensure.NotNull(api, "api"); this.edmType = edmType; - this.Api = api; } /// @@ -38,10 +35,5 @@ public IEdmTypeReference EdmType return this.edmType; } } - - /// - /// Gets the context where the action is executed. - /// - public ApiBase Api { get; private set; } } } diff --git a/src/Microsoft.Restier.Publishers.OData/Results/BaseSingleResult.cs b/src/Microsoft.Restier.Publishers.OData/Results/BaseSingleResult.cs index ccd83da9..fe615ac1 100644 --- a/src/Microsoft.Restier.Publishers.OData/Results/BaseSingleResult.cs +++ b/src/Microsoft.Restier.Publishers.OData/Results/BaseSingleResult.cs @@ -19,9 +19,8 @@ internal abstract class BaseSingleResult : BaseResult /// /// The query that returns an object. /// The EDM type reference of the object. - /// The api instance where the action is executed. - protected BaseSingleResult(IQueryable query, IEdmTypeReference edmType, ApiBase api) - : base(edmType, api) + protected BaseSingleResult(IQueryable query, IEdmTypeReference edmType) + : base(edmType) { Ensure.NotNull(query, "query"); diff --git a/src/Microsoft.Restier.Publishers.OData/Results/ComplexResult.cs b/src/Microsoft.Restier.Publishers.OData/Results/ComplexResult.cs index e2e9e684..3447fafc 100644 --- a/src/Microsoft.Restier.Publishers.OData/Results/ComplexResult.cs +++ b/src/Microsoft.Restier.Publishers.OData/Results/ComplexResult.cs @@ -17,9 +17,8 @@ internal class ComplexResult : BaseSingleResult /// /// The query that returns a complex value. /// The EDM type reference of the complex value. - /// The api instance where the action is executed. - public ComplexResult(IQueryable query, IEdmTypeReference edmType, ApiBase api) - : base(query, edmType, api) + public ComplexResult(IQueryable query, IEdmTypeReference edmType) + : base(query, edmType) { } } diff --git a/src/Microsoft.Restier.Publishers.OData/Results/EnumResult.cs b/src/Microsoft.Restier.Publishers.OData/Results/EnumResult.cs index aa707768..0566c000 100644 --- a/src/Microsoft.Restier.Publishers.OData/Results/EnumResult.cs +++ b/src/Microsoft.Restier.Publishers.OData/Results/EnumResult.cs @@ -17,9 +17,8 @@ internal class EnumResult : BaseSingleResult /// /// The query that returns a enum value. /// The EDM type reference of the enum value. - /// The api instance where the action is executed. - public EnumResult(IQueryable query, IEdmTypeReference edmType, ApiBase api) - : base(query, edmType, api) + public EnumResult(IQueryable query, IEdmTypeReference edmType) + : base(query, edmType) { } } diff --git a/src/Microsoft.Restier.Publishers.OData/Results/NonResourceCollectionResult.cs b/src/Microsoft.Restier.Publishers.OData/Results/NonResourceCollectionResult.cs index 09c4b8e0..37a2a229 100644 --- a/src/Microsoft.Restier.Publishers.OData/Results/NonResourceCollectionResult.cs +++ b/src/Microsoft.Restier.Publishers.OData/Results/NonResourceCollectionResult.cs @@ -17,9 +17,8 @@ internal class NonResourceCollectionResult : BaseCollectionResult /// /// The query that returns a collection of non-entity or complex values. /// The EDM type reference of the values. - /// The api instance where the action is executed. - public NonResourceCollectionResult(IQueryable query, IEdmTypeReference edmType, ApiBase api) - : base(query, edmType, api) + public NonResourceCollectionResult(IQueryable query, IEdmTypeReference edmType) + : base(query, edmType) { } } diff --git a/src/Microsoft.Restier.Publishers.OData/Results/PrimitiveResult.cs b/src/Microsoft.Restier.Publishers.OData/Results/PrimitiveResult.cs index 682f8da7..ea3f5bf9 100644 --- a/src/Microsoft.Restier.Publishers.OData/Results/PrimitiveResult.cs +++ b/src/Microsoft.Restier.Publishers.OData/Results/PrimitiveResult.cs @@ -17,9 +17,8 @@ internal class PrimitiveResult : BaseSingleResult /// /// The query that returns a primitive value. /// The EDM type reference of the primitive value. - /// The api instance where the action is executed. - public PrimitiveResult(IQueryable query, IEdmTypeReference edmType, ApiBase api) - : base(query, edmType, api) + public PrimitiveResult(IQueryable query, IEdmTypeReference edmType) + : base(query, edmType) { } } diff --git a/src/Microsoft.Restier.Publishers.OData/Results/RawResult.cs b/src/Microsoft.Restier.Publishers.OData/Results/RawResult.cs index e23be841..5c0992e8 100644 --- a/src/Microsoft.Restier.Publishers.OData/Results/RawResult.cs +++ b/src/Microsoft.Restier.Publishers.OData/Results/RawResult.cs @@ -17,9 +17,8 @@ internal class RawResult : BaseSingleResult /// /// The query that returns a primitive value. /// The EDM type reference of the primitive value. - /// The api instance where the action is executed. - public RawResult(IQueryable query, IEdmTypeReference edmType, ApiBase api) - : base(query, edmType, api) + public RawResult(IQueryable query, IEdmTypeReference edmType) + : base(query, edmType) { } } diff --git a/src/Microsoft.Restier.Publishers.OData/Results/ResourceSetResult.cs b/src/Microsoft.Restier.Publishers.OData/Results/ResourceSetResult.cs index db547184..1a612e8d 100644 --- a/src/Microsoft.Restier.Publishers.OData/Results/ResourceSetResult.cs +++ b/src/Microsoft.Restier.Publishers.OData/Results/ResourceSetResult.cs @@ -17,9 +17,8 @@ internal class ResourceSetResult : BaseCollectionResult /// /// The query that returns a collection of resources. /// The EDM type reference of the entities or complex. - /// The api instance where the action is executed. - public ResourceSetResult(IQueryable query, IEdmTypeReference edmType, ApiBase api) - : base(query, edmType, api) + public ResourceSetResult(IQueryable query, IEdmTypeReference edmType) + : base(query, edmType) { } }