diff --git a/src/GlobalSuppressions.cs b/src/GlobalSuppressions.cs index 3bbed85c..f8ac274a 100644 --- a/src/GlobalSuppressions.cs +++ b/src/GlobalSuppressions.cs @@ -37,25 +37,21 @@ #region CA1006 Nested Generic Type [assembly: SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.Restier.Core.ApiBaseExtensions.#QueryAsync`1(Microsoft.Restier.Core.ApiBase,System.Linq.IQueryable`1,System.Threading.CancellationToken)")] [assembly: SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.Restier.Core.ApiBaseExtensions.#QueryAsync`2(Microsoft.Restier.Core.ApiBase,System.Linq.IQueryable`1,System.Linq.Expressions.Expression`1,!!1>>,System.Threading.CancellationToken)")] -[assembly: SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.Restier.Core.Model.ModelContext.#EntityTypeKeyPropertiesMap")] +[assembly: SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.Restier.Core.Model.ModelContext.#ResourceTypeKeyPropertiesMap")] [assembly: SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.Restier.Core.Query.QueryRequest.#Create`2(System.Linq.IQueryable`1,System.Linq.Expressions.Expression`1,!!1>>,System.Nullable`1)")] #endregion #region CA1020 Few types in namespace [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Core")] -[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Core.Exceptions")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Core.Model")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Core.Operation")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Providers.EntityFramework")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Providers.EntityFramework.Model")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Providers.EntityFramework.Query")] -[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Providers.EntityFramework.Spatial")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Providers.EntityFramework.Submit")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Publishers.OData")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Publishers.OData.Batch")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Publishers.OData.Filters")] -[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Publishers.OData.Formatter.Deserialization")] -[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Publishers.OData.Formatter.Serialization")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Publishers.OData.Model")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Publishers.OData.Results")] [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.Restier.Publishers.OData.Routing")] @@ -80,9 +76,9 @@ [assembly: SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.Routing.HttpConfigurationExtensions.#MapRestierRoute`1(System.Web.Http.HttpConfiguration,System.String,System.String,System.Func`1,Microsoft.Restier.Publishers.OData.Batch.RestierBatchHandler)")] [assembly: SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.Routing.HttpConfigurationExtensions.#MapRestierRoute`1(System.Web.Http.HttpConfiguration,System.String,System.String,Microsoft.Restier.Publishers.OData.Batch.RestierBatchHandler)")] [assembly: SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "Microsoft.Restier.Publishers.OData.Batch.RestierBatchHandler.#.ctor(System.Web.Http.HttpServer,System.Func`1)")] -[assembly: SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "Microsoft.Restier.Core.Exceptions.PreconditionFailedException")] -[assembly: SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "Microsoft.Restier.Core.Exceptions.ResourceNotFoundException")] -[assembly: SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "Microsoft.Restier.Core.Exceptions.PreconditionRequiredException")] +[assembly: SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "Microsoft.Restier.Core.PreconditionFailedException")] +[assembly: SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "Microsoft.Restier.Core.ResourceNotFoundException")] +[assembly: SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "Microsoft.Restier.Core.PreconditionRequiredException")] #endregion #region CA1704 Identifiers spelling @@ -90,7 +86,7 @@ [assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sourcer", Scope = "type", Target = "Microsoft.Restier.Providers.EntityFramework.Query.QueryExpressionSourcer")] [assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ef", Scope = "member", Target = "Microsoft.Restier.Providers.EntityFramework.ServiceCollectionExtensions.#AddEfProviderServices`1(Microsoft.Extensions.DependencyInjection.IServiceCollection)")] [assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ef", Scope = "member", Target = "Microsoft.Restier.Providers.EntityFramework.Submit.ChangeSetInitializer.#ConvertToEfValue(System.Type,System.Object)")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Etag", Scope = "member", Target = "Microsoft.Restier.Core.Submit.DataModificationItem.#ApplyEtag(System.Linq.IQueryable)")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Etag", Scope = "member", Target = "Microsoft.Restier.Core.Submit.DataModificationItem.#ValidateEtag(System.Linq.IQueryable)")] #endregion #region CA1709 Identifiers case @@ -162,9 +158,9 @@ [assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Restier.Core.ApiContext.#.ctor(Microsoft.Restier.Core.ApiConfiguration)")] [assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Restier.Core.QueryableSource.#System.Linq.IQueryProvider.CreateQuery`1(System.Linq.Expressions.Expression)")] [assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Restier.Core.QueryableSource.#System.Linq.IQueryProvider.CreateQuery(System.Linq.Expressions.Expression)")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Scope = "member", Target = "Microsoft.Restier.Core.Model.ModelContext.#EntitySetTypeMap")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Scope = "member", Target = "Microsoft.Restier.Core.Model.ModelContext.#EntityTypeKeyPropertiesMap")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Scope = "member", Target = "Microsoft.Restier.Core.Operation.OperationContext.#ParametersValue")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Scope = "member", Target = "Microsoft.Restier.Core.Model.ModelContext.#ResourceSetTypeMap")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Scope = "member", Target = "Microsoft.Restier.Core.Model.ModelContext.#ResourceTypeKeyPropertiesMap")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Scope = "member", Target = "Microsoft.Restier.Core.Operation.OperationContext.#ParameterValues")] #endregion #region CA1801 Unused Parameters diff --git a/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemAuthorizer.cs b/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemAuthorizer.cs index f5b8ad10..60ad9612 100644 --- a/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemAuthorizer.cs +++ b/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemAuthorizer.cs @@ -93,7 +93,7 @@ private static string GetAuthorizeMethodName(ChangeSetItem item) operationName = ConventionBasedChangeSetConstants.AuthorizeMethodDataModificationDelete; } - return operationName + dataModification.EntitySetName; + return operationName + dataModification.ResourceSetName; default: throw new InvalidOperationException(string.Format( diff --git a/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemProcessor.cs b/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemProcessor.cs index 5f02171f..e772780e 100644 --- a/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemProcessor.cs +++ b/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemProcessor.cs @@ -77,7 +77,7 @@ private static string GetMethodName(ChangeSetItem item, string suffix) operationName = ConventionBasedChangeSetConstants.FilterMethodDataModificationDelete; } - return operationName + suffix + dataModification.EntitySetName; + return operationName + suffix + dataModification.ResourceSetName; default: throw new InvalidOperationException(string.Format( @@ -91,7 +91,7 @@ private static object[] GetParameters(ChangeSetItem item) { case ChangeSetItemType.DataModification: DataModificationItem dataModification = (DataModificationItem)item; - return new object[] { dataModification.Entity }; + return new object[] { dataModification.Resource }; default: throw new InvalidOperationException(string.Format( diff --git a/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemValidator.cs b/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemValidator.cs index 8f889faf..96089171 100644 --- a/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemValidator.cs +++ b/src/Microsoft.Restier.Core/Conventions/ConventionBasedChangeSetItemValidator.cs @@ -31,7 +31,7 @@ public Task ValidateChangeSetItemAsync( DataModificationItem dataModificationItem = item as DataModificationItem; if (dataModificationItem != null) { - object entity = dataModificationItem.Entity; + object entity = dataModificationItem.Resource; // TODO GitHubIssue#50 : should this PropertyDescriptorCollection be cached? PropertyDescriptorCollection properties = diff --git a/src/Microsoft.Restier.Core/Conventions/ConventionBasedOperationProcessor.cs b/src/Microsoft.Restier.Core/Conventions/ConventionBasedOperationProcessor.cs index 155cbce1..6adb454a 100644 --- a/src/Microsoft.Restier.Core/Conventions/ConventionBasedOperationProcessor.cs +++ b/src/Microsoft.Restier.Core/Conventions/ConventionBasedOperationProcessor.cs @@ -66,9 +66,9 @@ private Task InvokeProcessorMethodAsync( string methodName = ConventionBasedChangeSetConstants.FilterMethodActionInvocationExecute + methodNameSuffix + context.OperationName; object[] parameters = null; - if (context.ParametersValue != null) + if (context.ParameterValues != null) { - context.ParametersValue.ToArray(); + context.ParameterValues.ToArray(); } MethodInfo method = this.targetType.GetQualifiedMethod(methodName); diff --git a/src/Microsoft.Restier.Core/Exceptions/PreconditionFailedException.cs b/src/Microsoft.Restier.Core/Exceptions/PreconditionFailedException.cs index 76694e48..a4c3c1f8 100644 --- a/src/Microsoft.Restier.Core/Exceptions/PreconditionFailedException.cs +++ b/src/Microsoft.Restier.Core/Exceptions/PreconditionFailedException.cs @@ -3,13 +3,13 @@ using System; -namespace Microsoft.Restier.Core.Exceptions +namespace Microsoft.Restier.Core { /// /// This exception is used for 412 Precondition Failed response. /// [Serializable] - public class PreconditionFailedException : System.Exception + public class PreconditionFailedException : Exception { /// /// Initializes a new instance of the PreconditionFailedException class. diff --git a/src/Microsoft.Restier.Core/Exceptions/PreconditionRequiredException.cs b/src/Microsoft.Restier.Core/Exceptions/PreconditionRequiredException.cs index e63df010..d7e070a0 100644 --- a/src/Microsoft.Restier.Core/Exceptions/PreconditionRequiredException.cs +++ b/src/Microsoft.Restier.Core/Exceptions/PreconditionRequiredException.cs @@ -3,13 +3,13 @@ using System; -namespace Microsoft.Restier.Core.Exceptions +namespace Microsoft.Restier.Core { /// /// This exception is used for 428 Precondition required response. /// [Serializable] - public class PreconditionRequiredException : System.Exception + public class PreconditionRequiredException : Exception { /// /// Initializes a new instance of the PreconditionRequiredException class. diff --git a/src/Microsoft.Restier.Core/Exceptions/ResourceNotFoundException.cs b/src/Microsoft.Restier.Core/Exceptions/ResourceNotFoundException.cs index 4a39d75d..5f64cbae 100644 --- a/src/Microsoft.Restier.Core/Exceptions/ResourceNotFoundException.cs +++ b/src/Microsoft.Restier.Core/Exceptions/ResourceNotFoundException.cs @@ -3,13 +3,13 @@ using System; -namespace Microsoft.Restier.Core.Exceptions +namespace Microsoft.Restier.Core { /// /// This exception is used for 404 Not found response. /// [Serializable] - public class ResourceNotFoundException : System.Exception + public class ResourceNotFoundException : Exception { /// /// Initializes a new instance of the ResourceNotFoundException class. diff --git a/src/Microsoft.Restier.Core/Microsoft.Restier.Core.csproj b/src/Microsoft.Restier.Core/Microsoft.Restier.Core.csproj index c700ad04..464905eb 100644 --- a/src/Microsoft.Restier.Core/Microsoft.Restier.Core.csproj +++ b/src/Microsoft.Restier.Core/Microsoft.Restier.Core.csproj @@ -41,6 +41,9 @@ Shared\Ensure.cs + + Shared\EnumerableExtensions.cs + Shared\ExpressionHelperMethods.cs @@ -49,6 +52,11 @@ Shared\TypeExtensions.cs + + + True + True + SharedResources.resx diff --git a/src/Microsoft.Restier.Core/Model/ModelContext.cs b/src/Microsoft.Restier.Core/Model/ModelContext.cs index 14692c6b..e065d600 100644 --- a/src/Microsoft.Restier.Core/Model/ModelContext.cs +++ b/src/Microsoft.Restier.Core/Model/ModelContext.cs @@ -24,16 +24,16 @@ public ModelContext(ApiContext apiContext) } /// - /// Gets or sets Entity set and entity type map dictionary, it will be used by publisher for model build. + /// Gets or sets resource set and resource type map dictionary, it will be used by publisher for model build. /// - public IDictionary EntitySetTypeMap { get; set; } + public IDictionary ResourceSetTypeMap { get; set; } /// - /// Gets or sets entity type and its key properties map dictionary, and used by publisher for model build. + /// Gets or sets resource type and its key properties map dictionary, and used by publisher for model build. /// This is useful when key properties does not have key attribute /// or follow Web Api OData key property naming convention. /// Otherwise, this collection is not needed. /// - public IDictionary> EntityTypeKeyPropertiesMap { get; set; } + public IDictionary> ResourceTypeKeyPropertiesMap { get; set; } } } diff --git a/src/Microsoft.Restier.Core/Operation/OperationContext.cs b/src/Microsoft.Restier.Core/Operation/OperationContext.cs index 8d067bc6..841a3fff 100644 --- a/src/Microsoft.Restier.Core/Operation/OperationContext.cs +++ b/src/Microsoft.Restier.Core/Operation/OperationContext.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. using System; +using System.Collections; using System.Collections.Generic; using System.Linq; @@ -16,8 +17,8 @@ public class OperationContext : InvocationContext private readonly string operationName; private readonly Func getParameterValueFunc; private readonly bool isFunction; - private readonly IQueryable bindingParameterValue; - private ICollection parametersValue; + private readonly IEnumerable bindingParameterValue; + private ICollection parameterValues; /// /// Initializes a new instance of the class. @@ -42,7 +43,7 @@ public OperationContext( Func getParameterValueFunc, string operationName, bool isFunction, - IQueryable bindingParameterValue) + IEnumerable bindingParameterValue) : base(apiContext) { this.getParameterValueFunc = getParameterValueFunc; @@ -88,7 +89,7 @@ public bool IsFunction /// Gets the queryable for binding parameter value, /// and if it is function/action import, the value will be null. /// - public IQueryable BindingParameterValue + public IEnumerable BindingParameterValue { get { @@ -100,16 +101,16 @@ public IQueryable BindingParameterValue /// Gets or sets the parameters value array used by method, /// It is only set after parameters are prepared. /// - public ICollection ParametersValue + public ICollection ParameterValues { get { - return this.parametersValue; + return this.parameterValues; } set { - this.parametersValue = value; + this.parameterValues = value; } } } diff --git a/src/Microsoft.Restier.Core/Properties/Resources.Designer.cs b/src/Microsoft.Restier.Core/Properties/Resources.Designer.cs index 5684be17..3bc681cf 100644 --- a/src/Microsoft.Restier.Core/Properties/Resources.Designer.cs +++ b/src/Microsoft.Restier.Core/Properties/Resources.Designer.cs @@ -276,6 +276,15 @@ internal static string OriginalExpressionShouldBeQueryable { } } + /// + /// Looks up a localized string similar to The precondition check for request {0} on resource {1} is failed.. + /// + internal static string PreconditionCheckFailed { + get { + return ResourceManager.GetString("PreconditionCheckFailed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Processor cannot change the expression type.. /// diff --git a/src/Microsoft.Restier.Core/Properties/Resources.resx b/src/Microsoft.Restier.Core/Properties/Resources.resx index 3b3b7c31..2c86379e 100644 --- a/src/Microsoft.Restier.Core/Properties/Resources.resx +++ b/src/Microsoft.Restier.Core/Properties/Resources.resx @@ -216,4 +216,7 @@ The request resource is not found. + + The precondition check for request {0} on resource {1} is failed. + \ No newline at end of file diff --git a/src/Microsoft.Restier.Core/Query/DefaultQueryHandler.cs b/src/Microsoft.Restier.Core/Query/DefaultQueryHandler.cs index edf268a2..e60d4e51 100644 --- a/src/Microsoft.Restier.Core/Query/DefaultQueryHandler.cs +++ b/src/Microsoft.Restier.Core/Query/DefaultQueryHandler.cs @@ -9,7 +9,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.OData.Edm; -using Microsoft.Restier.Core.Exceptions; using Microsoft.Restier.Core.Properties; namespace Microsoft.Restier.Core.Query diff --git a/src/Microsoft.Restier.Core/Submit/ChangeSetItem.cs b/src/Microsoft.Restier.Core/Submit/ChangeSetItem.cs index 706773c5..8e930d42 100644 --- a/src/Microsoft.Restier.Core/Submit/ChangeSetItem.cs +++ b/src/Microsoft.Restier.Core/Submit/ChangeSetItem.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. using System; +using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -15,7 +16,7 @@ namespace Microsoft.Restier.Core.Submit /// /// /// This is required because during the post-CUD events, the EntityState has been lost. - /// This enum allows the API to remember which pre-CUD event was raised for the Entity. + /// This enum allows the API to remember which pre-CUD event was raised for the Resource. /// public enum DataModificationItemAction { @@ -127,13 +128,13 @@ public class DataModificationItem : ChangeSetItem /// /// Initializes a new instance of the class. /// - /// + /// /// The name of the entity set in question. /// - /// + /// /// The type of the expected entity type in question. /// - /// + /// /// The type of the actual entity type in question. /// /// @@ -149,20 +150,20 @@ public class DataModificationItem : ChangeSetItem /// The local values of the entity. /// public DataModificationItem( - string entitySetName, - Type expectedEntityType, - Type actualEntityType, + string resourceSetName, + Type expectedResourceType, + Type actualResourceType, DataModificationItemAction action, IReadOnlyDictionary entityKey, IReadOnlyDictionary originalValues, IReadOnlyDictionary localValues) : base(ChangeSetItemType.DataModification) { - Ensure.NotNull(entitySetName, "entitySetName"); - Ensure.NotNull(expectedEntityType, "expectedEntityType"); - this.EntitySetName = entitySetName; - this.ExpectedEntityType = expectedEntityType; - this.ActualEntityType = actualEntityType; + Ensure.NotNull(resourceSetName, "resourceSetName"); + Ensure.NotNull(expectedResourceType, "expectedResourceType"); + this.ResourceSetName = resourceSetName; + this.ExpectedEntityType = expectedResourceType; + this.ActualResourceType = actualResourceType; this.EntityKey = entityKey; this.OriginalValues = originalValues; this.LocalValues = localValues; @@ -172,7 +173,7 @@ public DataModificationItem( /// /// Gets the name of the entity set in question. /// - public string EntitySetName { get; private set; } + public string ResourceSetName { get; private set; } /// /// Gets the name of the expected entity type in question. @@ -183,7 +184,7 @@ public DataModificationItem( /// Gets the name of the actual entity type in question. /// In type inheritance case, this is different from expectedEntityType /// - public Type ActualEntityType { get; private set; } + public Type ActualResourceType { get; private set; } /// /// Gets the key of the entity being modified. @@ -205,13 +206,13 @@ public DataModificationItem( public bool IsFullReplaceUpdateRequest { get; set; } /// - /// Gets or sets the entity object in question. + /// Gets or sets the resource object in question. /// /// /// Initially this will be null, however after the change /// set has been prepared it will represent the pending entity. /// - public object Entity { get; set; } + public object Resource { get; set; } /// /// Gets the original values for properties that have changed. @@ -288,14 +289,14 @@ public IQueryable ApplyTo(IQueryable query) } /// - /// Applies the current DataModificationItem's OriginalValues to the - /// specified query and returns the new query. + /// Validate the e-tag via applies the current DataModificationItem's OriginalValues to the + /// specified query and returns result. /// /// The IQueryable to apply the property values to. /// - /// The new IQueryable with the property values applied to it in a Where condition. + /// The object is e-tag checked passed. /// - public IQueryable ApplyEtag(IQueryable query) + public object ValidateEtag(IQueryable query) { Ensure.NotNull(query, "query"); Type type = query.ElementType; @@ -319,7 +320,20 @@ public IQueryable ApplyEtag(IQueryable query) } LambdaExpression whereLambda = Expression.Lambda(where, param); - return ExpressionHelpers.Where(query, whereLambda, type); + var queryable = ExpressionHelpers.Where(query, whereLambda, type); + + var etagEntity = queryable.SingleOrDefault(); + if (etagEntity == null) + { + // If ETAG does not match, should return 412 Precondition Failed + var message = string.Format( + CultureInfo.InvariantCulture, + Resources.PreconditionCheckFailed, + new object[] { this.DataModificationItemAction, query.SingleOrDefault() }); + throw new PreconditionFailedException(message); + } + + return etagEntity; } private static Expression ApplyPredicate( @@ -355,14 +369,14 @@ public class DataModificationItem : DataModificationItem /// /// Initializes a new instance of the class. /// - /// - /// The name of the entity set in question. + /// + /// The name of the resource set in question. /// - /// - /// The type of the expected entity type in question. + /// + /// The type of the expected resource type in question. /// - /// - /// The type of the actual entity type in question. + /// + /// The type of the actual resource type in question. /// /// /// The DataModificationItemAction for the request. @@ -377,14 +391,21 @@ public class DataModificationItem : DataModificationItem /// The local values of the entity. /// public DataModificationItem( - string entitySetName, - Type expectedEntityType, - Type actualEntityType, + string resourceSetName, + Type expectedResourceType, + Type actualResourceType, DataModificationItemAction action, IReadOnlyDictionary entityKey, IReadOnlyDictionary originalValues, IReadOnlyDictionary localValues) - : base(entitySetName, expectedEntityType, actualEntityType, action, entityKey, originalValues, localValues) + : base( + resourceSetName, + expectedResourceType, + actualResourceType, + action, + entityKey, + originalValues, + localValues) { } @@ -395,16 +416,16 @@ public DataModificationItem( /// Initially this will be null, however after the change /// set has been prepared it will represent the pending entity. /// - public new T Entity + public new T Resource { get { - return base.Entity as T; + return base.Resource as T; } set { - base.Entity = value; + base.Resource = value; } } } diff --git a/src/Microsoft.Restier.Core/Submit/DefaultSubmitHandler.cs b/src/Microsoft.Restier.Core/Submit/DefaultSubmitHandler.cs index f1772dd0..adb0d709 100644 --- a/src/Microsoft.Restier.Core/Submit/DefaultSubmitHandler.cs +++ b/src/Microsoft.Restier.Core/Submit/DefaultSubmitHandler.cs @@ -91,7 +91,7 @@ private static string GetAuthorizeFailedMessage(ChangeSetItem item) throw new NotSupportedException(Resources.DataModificationMustBeCUD); } - return string.Format(CultureInfo.InvariantCulture, message, dataModification.EntitySetName); + return string.Format(CultureInfo.InvariantCulture, message, dataModification.ResourceSetName); default: throw new InvalidOperationException(string.Format( diff --git a/src/Microsoft.Restier.Providers.EntityFramework/Model/ModelProducer.cs b/src/Microsoft.Restier.Providers.EntityFramework/Model/ModelProducer.cs index 774dea1f..ccd5b891 100644 --- a/src/Microsoft.Restier.Providers.EntityFramework/Model/ModelProducer.cs +++ b/src/Microsoft.Restier.Providers.EntityFramework/Model/ModelProducer.cs @@ -49,10 +49,10 @@ public Task GetModelAsync(ModelContext context, CancellationToken can #if EF7 var dbContext = context.ApiContext.GetApiService(); - context.EntitySetTypeMap = dbContext.GetType().GetProperties() + context.ResourceSetTypeMap = dbContext.GetType().GetProperties() .Where(e => e.PropertyType.FindGenericType(typeof(DbSet<>)) != null) .ToDictionary(e => e.Name, e => e.PropertyType.GetGenericArguments()[0]); - context.EntityTypeKeyPropertiesMap = dbContext.Model.GetEntityTypes().ToDictionary( + context.ResourceTypeKeyPropertiesMap = dbContext.Model.GetEntityTypes().ToDictionary( e => e.ClrType, e => ((ICollection) e.FindPrimaryKey().Properties.Select(p => e.ClrType.GetProperty(p.Name)).ToList())); @@ -83,8 +83,8 @@ public Task GetModelAsync(ModelContext context, CancellationToken can entityTypeKeyPropertiesMap.Add(clrType, keyProperties); } - context.EntitySetTypeMap = entitySetTypeMap; - context.EntityTypeKeyPropertiesMap = entityTypeKeyPropertiesMap; + context.ResourceSetTypeMap = entitySetTypeMap; + context.ResourceTypeKeyPropertiesMap = entityTypeKeyPropertiesMap; #endif if (InnerModelBuilder != null) { diff --git a/src/Microsoft.Restier.Providers.EntityFramework/Spatial/GeographyConverter.cs b/src/Microsoft.Restier.Providers.EntityFramework/Spatial/GeographyConverter.cs index 50136689..3b74a8c8 100644 --- a/src/Microsoft.Restier.Providers.EntityFramework/Spatial/GeographyConverter.cs +++ b/src/Microsoft.Restier.Providers.EntityFramework/Spatial/GeographyConverter.cs @@ -8,7 +8,7 @@ using Microsoft.Restier.Providers.EntityFramework.Properties; using Microsoft.Spatial; -namespace Microsoft.Restier.Providers.EntityFramework.Spatial +namespace Microsoft.Restier.Providers.EntityFramework { /// /// The class defined conversion between GeographyPoint and DbGeography, diff --git a/src/Microsoft.Restier.Providers.EntityFramework/Submit/ChangeSetInitializer.cs b/src/Microsoft.Restier.Providers.EntityFramework/Submit/ChangeSetInitializer.cs index 19dc61e6..21b56a71 100644 --- a/src/Microsoft.Restier.Providers.EntityFramework/Submit/ChangeSetInitializer.cs +++ b/src/Microsoft.Restier.Providers.EntityFramework/Submit/ChangeSetInitializer.cs @@ -14,11 +14,9 @@ using System.Threading.Tasks; using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core; -using Microsoft.Restier.Core.Exceptions; using Microsoft.Restier.Core.Query; using Microsoft.Restier.Core.Submit; using Microsoft.Restier.Providers.EntityFramework.Properties; -using Microsoft.Restier.Providers.EntityFramework.Spatial; using Microsoft.Spatial; namespace Microsoft.Restier.Providers.EntityFramework.Submit @@ -42,50 +40,50 @@ public async Task InitializeAsync( foreach (var entry in context.ChangeSet.Entries.OfType()) { - object strongTypedDbSet = dbContext.GetType().GetProperty(entry.EntitySetName).GetValue(dbContext); - Type entityType = strongTypedDbSet.GetType().GetGenericArguments()[0]; + object strongTypedDbSet = dbContext.GetType().GetProperty(entry.ResourceSetName).GetValue(dbContext); + Type resourceType = strongTypedDbSet.GetType().GetGenericArguments()[0]; // This means request entity is sub type of entity type - if (entry.ActualEntityType != null && entityType != entry.ActualEntityType) + if (entry.ActualResourceType != null && resourceType != entry.ActualResourceType) { - entityType = entry.ActualEntityType; + resourceType = entry.ActualResourceType; } - DbSet set = dbContext.Set(entityType); + DbSet set = dbContext.Set(resourceType); - object entity; + object resource; if (entry.DataModificationItemAction == DataModificationItemAction.Insert) { - entity = set.Create(); + resource = set.Create(); - SetValues(entity, entityType, entry.LocalValues); + SetValues(resource, resourceType, entry.LocalValues); - set.Add(entity); + set.Add(resource); } else if (entry.DataModificationItemAction == DataModificationItemAction.Remove) { - entity = await FindEntity(context, entry, cancellationToken); - set.Remove(entity); + resource = await FindEntity(context, entry, cancellationToken); + set.Remove(resource); } else if (entry.DataModificationItemAction == DataModificationItemAction.Update) { - entity = await FindEntity(context, entry, cancellationToken); + resource = await FindEntity(context, entry, cancellationToken); - DbEntityEntry dbEntry = dbContext.Entry(entity); - SetValues(dbEntry, entry, entityType); + DbEntityEntry dbEntry = dbContext.Entry(resource); + SetValues(dbEntry, entry, resourceType); } else { throw new NotSupportedException(Resources.DataModificationMustBeCUD); } - entry.Entity = entity; + entry.Resource = resource; } } /// - /// Convert a Edm type value to Entity Framework supported value type + /// Convert a Edm type value to Resource Framework supported value type /// /// The type of the property defined in CLR class /// The value from OData deserializer and in type of Edm @@ -148,7 +146,7 @@ private static async Task FindEntity( DataModificationItem item, CancellationToken cancellationToken) { - IQueryable query = context.ApiContext.GetQueryableSource(item.EntitySetName); + IQueryable query = context.ApiContext.GetQueryableSource(item.ResourceSetName); query = item.ApplyTo(query); QueryResult result = await context.ApiContext.QueryAsync(new QueryRequest(query), cancellationToken); @@ -165,17 +163,7 @@ private static async Task FindEntity( return entity; } - var etagEntity = item.ApplyEtag(result.Results.AsQueryable()).SingleOrDefault(); - if (etagEntity == null) - { - // If ETAG does not match, should return 412 Precondition Failed - var message = string.Format( - CultureInfo.InvariantCulture, - Resources.PreconditionCheckFailed, - new object[] { item.DataModificationItemAction, entity }); - throw new PreconditionFailedException(message); - } - + var etagEntity = item.ValidateEtag(result.Results.AsQueryable()); return etagEntity; } diff --git a/src/Microsoft.Restier.Publishers.OData/Filters/RestierExceptionFilterAttribute.cs b/src/Microsoft.Restier.Publishers.OData/Filters/RestierExceptionFilterAttribute.cs index ad5ad830..265c844e 100644 --- a/src/Microsoft.Restier.Publishers.OData/Filters/RestierExceptionFilterAttribute.cs +++ b/src/Microsoft.Restier.Publishers.OData/Filters/RestierExceptionFilterAttribute.cs @@ -15,9 +15,8 @@ using System.Web.Http.Filters; using System.Web.Http.Results; using Microsoft.OData.Core; -using Microsoft.Restier.Core.Exceptions; +using Microsoft.Restier.Core; using Microsoft.Restier.Core.Submit; -using Microsoft.Restier.Publishers.OData.Query; using Net::System.Net.Http.Formatting; namespace Microsoft.Restier.Publishers.OData.Filters diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/DefaultRestierDeserializerProvider.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/DefaultRestierDeserializerProvider.cs index 96ce1f0d..ff419019 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/DefaultRestierDeserializerProvider.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/DefaultRestierDeserializerProvider.cs @@ -4,7 +4,7 @@ using System.Web.OData.Formatter.Deserialization; using Microsoft.OData.Edm; -namespace Microsoft.Restier.Publishers.OData.Formatter.Deserialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The default deserializer provider. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/DeserializationHelpers.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/DeserializationHelpers.cs index f99ffb23..d2d1918f 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/DeserializationHelpers.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/DeserializationHelpers.cs @@ -9,7 +9,7 @@ using Microsoft.OData.Edm; using Microsoft.Restier.Core; -namespace Microsoft.Restier.Publishers.OData.Formatter.Deserialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// Get clr type from payload. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierDeserializerProviderProxy.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierDeserializerProviderProxy.cs index 6ea45eb6..d4965f76 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierDeserializerProviderProxy.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierDeserializerProviderProxy.cs @@ -7,7 +7,7 @@ using Microsoft.OData.Edm; using Microsoft.Restier.Core; -namespace Microsoft.Restier.Publishers.OData.Formatter.Deserialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The deserializer provider proxy which get real provider to implement the logic. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierEnumDeserializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierEnumDeserializer.cs index cffa04ba..552a747f 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierEnumDeserializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierEnumDeserializer.cs @@ -7,7 +7,7 @@ using Microsoft.OData.Core; using Microsoft.OData.Edm; -namespace Microsoft.Restier.Publishers.OData.Formatter.Deserialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The serializer for enum result. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/RestierFormattingAttribute.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/RestierFormattingAttribute.cs index b2cbf821..2889fb32 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/RestierFormattingAttribute.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/RestierFormattingAttribute.cs @@ -6,8 +6,6 @@ using System.Linq; using System.Web.Http.Controllers; using System.Web.OData.Formatter; -using Microsoft.Restier.Publishers.OData.Formatter.Deserialization; -using Microsoft.Restier.Publishers.OData.Formatter.Serialization; namespace Microsoft.Restier.Publishers.OData.Formatter { diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/DefaultRestierSerializerProvider.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/DefaultRestierSerializerProvider.cs index 57a9665f..c894765e 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/DefaultRestierSerializerProvider.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/DefaultRestierSerializerProvider.cs @@ -7,7 +7,7 @@ using Microsoft.OData.Edm; using Microsoft.Restier.Publishers.OData.Results; -namespace Microsoft.Restier.Publishers.OData.Formatter.Serialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The default serializer provider. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierCollectionSerializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierCollectionSerializer.cs index ba49cbeb..86174b44 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierCollectionSerializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierCollectionSerializer.cs @@ -6,7 +6,7 @@ using Microsoft.OData.Core; using Microsoft.Restier.Publishers.OData.Results; -namespace Microsoft.Restier.Publishers.OData.Formatter.Serialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The serializer for collection result. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierComplexTypeSerializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierComplexTypeSerializer.cs index 0791685b..37b1a39e 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierComplexTypeSerializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierComplexTypeSerializer.cs @@ -6,7 +6,7 @@ using Microsoft.OData.Core; using Microsoft.Restier.Publishers.OData.Results; -namespace Microsoft.Restier.Publishers.OData.Formatter.Serialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The serializer for complex result. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierEnumSerializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierEnumSerializer.cs index e8d01208..034a3699 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierEnumSerializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierEnumSerializer.cs @@ -6,7 +6,7 @@ using Microsoft.OData.Core; using Microsoft.Restier.Publishers.OData.Results; -namespace Microsoft.Restier.Publishers.OData.Formatter.Serialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The serializer for enum result. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierFeedSerializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierFeedSerializer.cs index 0c03cdee..48a607d1 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierFeedSerializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierFeedSerializer.cs @@ -9,7 +9,7 @@ using Microsoft.OData.Edm; using Microsoft.Restier.Publishers.OData.Results; -namespace Microsoft.Restier.Publishers.OData.Formatter.Serialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The serializer for entity collection result. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierPrimitiveSerializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierPrimitiveSerializer.cs index 55a7e81f..5c7a566c 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierPrimitiveSerializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierPrimitiveSerializer.cs @@ -8,7 +8,7 @@ using Microsoft.OData.Edm.Library; using Microsoft.Restier.Publishers.OData.Results; -namespace Microsoft.Restier.Publishers.OData.Formatter.Serialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The serializer for primitive result. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierRawSerializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierRawSerializer.cs index 5a3b26f6..331af013 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierRawSerializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierRawSerializer.cs @@ -6,7 +6,7 @@ using Microsoft.OData.Core; using Microsoft.Restier.Publishers.OData.Results; -namespace Microsoft.Restier.Publishers.OData.Formatter.Serialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The serializer for raw result. diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierSerializerProviderProxy.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierSerializerProviderProxy.cs index ef930a80..5930cc51 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierSerializerProviderProxy.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierSerializerProviderProxy.cs @@ -7,7 +7,7 @@ using Microsoft.OData.Edm; using Microsoft.Restier.Core; -namespace Microsoft.Restier.Publishers.OData.Formatter.Serialization +namespace Microsoft.Restier.Publishers.OData.Formatter { /// /// The serializer provider proxy which get real provider to implement the logic. diff --git a/src/Microsoft.Restier.Publishers.OData/Microsoft.Restier.Publishers.OData.csproj b/src/Microsoft.Restier.Publishers.OData/Microsoft.Restier.Publishers.OData.csproj index 7dc28fee..549505ff 100644 --- a/src/Microsoft.Restier.Publishers.OData/Microsoft.Restier.Publishers.OData.csproj +++ b/src/Microsoft.Restier.Publishers.OData/Microsoft.Restier.Publishers.OData.csproj @@ -129,7 +129,7 @@ - + True True SharedResources.resx diff --git a/src/Microsoft.Restier.Publishers.OData/Model/RestierModelBuilder.cs b/src/Microsoft.Restier.Publishers.OData/Model/RestierModelBuilder.cs index 0fcdfb80..df18bdba 100644 --- a/src/Microsoft.Restier.Publishers.OData/Model/RestierModelBuilder.cs +++ b/src/Microsoft.Restier.Publishers.OData/Model/RestierModelBuilder.cs @@ -31,7 +31,7 @@ public async Task GetModelAsync(ModelContext context, CancellationTok innerModel = await InnerModelBuilder.GetModelAsync(context, cancellationToken); } - var entitySetTypeMap = context.EntitySetTypeMap; + var entitySetTypeMap = context.ResourceSetTypeMap; if (entitySetTypeMap == null || entitySetTypeMap.Count == 0) { return innerModel; @@ -63,7 +63,7 @@ public async Task GetModelAsync(ModelContext context, CancellationTok entitySetTypeMap.Clear(); - var entityTypeKeyPropertiesMap = context.EntityTypeKeyPropertiesMap; + var entityTypeKeyPropertiesMap = context.ResourceTypeKeyPropertiesMap; if (entityTypeKeyPropertiesMap != null) { foreach (var pair in entityTypeKeyPropertiesMap) diff --git a/src/Microsoft.Restier.Publishers.OData/Operation/OperationExecutor.cs b/src/Microsoft.Restier.Publishers.OData/Operation/OperationExecutor.cs index df8b0d59..b79c1c35 100644 --- a/src/Microsoft.Restier.Publishers.OData/Operation/OperationExecutor.cs +++ b/src/Microsoft.Restier.Publishers.OData/Operation/OperationExecutor.cs @@ -13,9 +13,8 @@ using System.Threading.Tasks; using Microsoft.OData.Edm; using Microsoft.Restier.Core; -using Microsoft.Restier.Core.Exceptions; using Microsoft.Restier.Core.Operation; -using Microsoft.Restier.Publishers.OData.Formatter.Deserialization; +using Microsoft.Restier.Publishers.OData.Formatter; using Microsoft.Restier.Publishers.OData.Properties; namespace Microsoft.Restier.Publishers.OData.Operation @@ -76,7 +75,7 @@ public async Task ExecuteOperationAsync( parameters[paraIndex] = convertedValue; } - context.ParametersValue = parameters; + context.ParameterValues = parameters; // Invoke preprocessing on the operation execution PerformPreEvent(context, cancellationToken); @@ -88,7 +87,7 @@ public async Task ExecuteOperationAsync( return result; } - private static object PrepareBindingParameter(Type bindingType, IQueryable bindingParameterValue) + private static object PrepareBindingParameter(Type bindingType, IEnumerable bindingParameterValue) { var enumerableType = bindingType.FindGenericType(typeof(IEnumerable<>)); diff --git a/src/Microsoft.Restier.Publishers.OData/RestierController.cs b/src/Microsoft.Restier.Publishers.OData/RestierController.cs index 777d10e5..fbccdba9 100644 --- a/src/Microsoft.Restier.Publishers.OData/RestierController.cs +++ b/src/Microsoft.Restier.Publishers.OData/RestierController.cs @@ -21,7 +21,6 @@ using Microsoft.OData.Edm; using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core; -using Microsoft.Restier.Core.Exceptions; using Microsoft.Restier.Core.Operation; using Microsoft.Restier.Core.Query; using Microsoft.Restier.Core.Submit; @@ -184,7 +183,7 @@ public async Task Post(EdmEntityObject edmEntityObject, Cance await changeSetProperty.OnChangeSetCompleted(); } - return this.CreateCreatedODataResult(postItem.Entity); + return this.CreateCreatedODataResult(postItem.Resource); } /// @@ -426,7 +425,7 @@ private async Task Update( await changeSetProperty.OnChangeSetCompleted(); } - return this.CreateUpdatedODataResult(updateItem.Entity); + return this.CreateUpdatedODataResult(updateItem.Resource); } private HttpResponseMessage CreateQueryResponse( diff --git a/src/Microsoft.Restier.Publishers.OData/ServiceCollectionExtensions.cs b/src/Microsoft.Restier.Publishers.OData/ServiceCollectionExtensions.cs index 587b0bd3..733d2670 100644 --- a/src/Microsoft.Restier.Publishers.OData/ServiceCollectionExtensions.cs +++ b/src/Microsoft.Restier.Publishers.OData/ServiceCollectionExtensions.cs @@ -11,8 +11,7 @@ using Microsoft.Restier.Core.Model; using Microsoft.Restier.Core.Operation; using Microsoft.Restier.Core.Query; -using Microsoft.Restier.Publishers.OData.Formatter.Deserialization; -using Microsoft.Restier.Publishers.OData.Formatter.Serialization; +using Microsoft.Restier.Publishers.OData.Formatter; using Microsoft.Restier.Publishers.OData.Model; using Microsoft.Restier.Publishers.OData.Operation; using Microsoft.Restier.Publishers.OData.Query; diff --git a/src/Shared/SharedResources/SharedResources.Core.Designer.cs b/src/Shared/SharedResources/SharedResources.Core.Designer.cs new file mode 100644 index 00000000..69f10407 --- /dev/null +++ b/src/Shared/SharedResources/SharedResources.Core.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Restier.Shared { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Restier.Providers.EntityFramework.SharedResources", typeof(SharedResources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to A query for a single entity resulted in more than one record.. + /// + internal static string QueryShouldGetSingleRecord { + get { + return ResourceManager.GetString("QueryShouldGetSingleRecord", resourceCulture); + } + } + } +} diff --git a/src/Shared/SharedResources/SharedResources.WebApi.Designer.cs b/src/Shared/SharedResources/SharedResources.OData.Designer.cs similarity index 100% rename from src/Shared/SharedResources/SharedResources.WebApi.Designer.cs rename to src/Shared/SharedResources/SharedResources.OData.Designer.cs diff --git a/test/Microsoft.Restier.Providers.EntityFramework.Tests/ChangeSetPreparerTests.cs b/test/Microsoft.Restier.Providers.EntityFramework.Tests/ChangeSetPreparerTests.cs index 44689ced..4b21bb90 100644 --- a/test/Microsoft.Restier.Providers.EntityFramework.Tests/ChangeSetPreparerTests.cs +++ b/test/Microsoft.Restier.Providers.EntityFramework.Tests/ChangeSetPreparerTests.cs @@ -33,7 +33,7 @@ public async Task ComplexTypeUpdate() // Act var changeSetPreparer = libraryApi.Context.Configuration.GetApiService(); await changeSetPreparer.InitializeAsync(sc, CancellationToken.None); - var person = item.Entity as Person; + var person = item.Resource as Person; // Assert Assert.NotNull(person); diff --git a/test/Microsoft.Restier.Publishers.OData.Test/StoreApi.cs b/test/Microsoft.Restier.Publishers.OData.Test/StoreApi.cs index 7af8d1d6..a3644dab 100644 --- a/test/Microsoft.Restier.Publishers.OData.Test/StoreApi.cs +++ b/test/Microsoft.Restier.Publishers.OData.Test/StoreApi.cs @@ -176,7 +176,7 @@ public Task InitializeAsync(SubmitContext context, CancellationToken cancellatio var dataModificationEntry = changeSetEntry as DataModificationItem; if (dataModificationEntry != null) { - dataModificationEntry.Entity = new Product() + dataModificationEntry.Resource = new Product() { Name = "var1", Addr = new Address() diff --git a/test/Microsoft.Restier.TestCommon/PublicApi.bsl b/test/Microsoft.Restier.TestCommon/PublicApi.bsl index c54cd63a..e61f8ffc 100644 --- a/test/Microsoft.Restier.TestCommon/PublicApi.bsl +++ b/test/Microsoft.Restier.TestCommon/PublicApi.bsl @@ -290,7 +290,7 @@ public class Microsoft.Restier.Core.InvocationContext { [ SerializableAttribute(), ] -public class Microsoft.Restier.Core.Exceptions.PreconditionFailedException : System.Exception, _Exception, ISerializable { +public class Microsoft.Restier.Core.PreconditionFailedException : System.Exception, _Exception, ISerializable { public PreconditionFailedException () public PreconditionFailedException (string message) public PreconditionFailedException (string message, System.Exception innerException) @@ -299,7 +299,7 @@ public class Microsoft.Restier.Core.Exceptions.PreconditionFailedException : Sys [ SerializableAttribute(), ] -public class Microsoft.Restier.Core.Exceptions.PreconditionRequiredException : System.Exception, _Exception, ISerializable { +public class Microsoft.Restier.Core.PreconditionRequiredException : System.Exception, _Exception, ISerializable { public PreconditionRequiredException () public PreconditionRequiredException (string message) public PreconditionRequiredException (string message, System.Exception innerException) @@ -308,7 +308,7 @@ public class Microsoft.Restier.Core.Exceptions.PreconditionRequiredException : S [ SerializableAttribute(), ] -public class Microsoft.Restier.Core.Exceptions.ResourceNotFoundException : System.Exception, _Exception, ISerializable { +public class Microsoft.Restier.Core.ResourceNotFoundException : System.Exception, _Exception, ISerializable { public ResourceNotFoundException () public ResourceNotFoundException (string message) public ResourceNotFoundException (string message, System.Exception innerException) @@ -326,8 +326,8 @@ public interface Microsoft.Restier.Core.Model.IModelMapper { public class Microsoft.Restier.Core.Model.ModelContext : Microsoft.Restier.Core.InvocationContext { public ModelContext (Microsoft.Restier.Core.ApiContext apiContext) - System.Collections.Generic.IDictionary`2[[System.String],[System.Type]] EntitySetTypeMap { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } - System.Collections.Generic.IDictionary`2[[System.Type],[System.Collections.Generic.ICollection`1[[System.Reflection.PropertyInfo]]]] EntityTypeKeyPropertiesMap { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } + System.Collections.Generic.IDictionary`2[[System.String],[System.Type]] ResourceSetTypeMap { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } + System.Collections.Generic.IDictionary`2[[System.Type],[System.Collections.Generic.ICollection`1[[System.Reflection.PropertyInfo]]]] ResourceTypeKeyPropertiesMap { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } } public interface Microsoft.Restier.Core.Operation.IOperationAuthorizer { @@ -344,13 +344,13 @@ public interface Microsoft.Restier.Core.Operation.IOperationProcessor { } public class Microsoft.Restier.Core.Operation.OperationContext : Microsoft.Restier.Core.InvocationContext { - public OperationContext (Microsoft.Restier.Core.ApiContext apiContext, System.Func`2[[System.String],[System.Object]] getParameterValueFunc, string operationName, bool isFunction, System.Linq.IQueryable bindingParameterValue) + public OperationContext (Microsoft.Restier.Core.ApiContext apiContext, System.Func`2[[System.String],[System.Object]] getParameterValueFunc, string operationName, bool isFunction, System.Collections.IEnumerable bindingParameterValue) - System.Linq.IQueryable BindingParameterValue { public get; } + System.Collections.IEnumerable BindingParameterValue { public get; } System.Func`2[[System.String],[System.Object]] GetParameterValueFunc { public get; } bool IsFunction { public get; } string OperationName { public get; } - System.Collections.Generic.ICollection`1[[System.Object]] ParametersValue { public get; public set; } + System.Collections.Generic.ICollection`1[[System.Object]] ParameterValues { public get; public set; } } public interface Microsoft.Restier.Core.Query.IQueryExecutor { @@ -491,27 +491,27 @@ public class Microsoft.Restier.Core.Submit.ChangeSetValidationException : System } public class Microsoft.Restier.Core.Submit.DataModificationItem : Microsoft.Restier.Core.Submit.ChangeSetItem { - public DataModificationItem (string entitySetName, System.Type expectedEntityType, System.Type actualEntityType, Microsoft.Restier.Core.Submit.DataModificationItemAction action, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] entityKey, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] originalValues, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] localValues) + public DataModificationItem (string resourceSetName, System.Type expectedResourceType, System.Type actualResourceType, Microsoft.Restier.Core.Submit.DataModificationItemAction action, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] entityKey, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] originalValues, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] localValues) - System.Type ActualEntityType { [CompilerGeneratedAttribute(),]public get; } + System.Type ActualResourceType { [CompilerGeneratedAttribute(),]public get; } Microsoft.Restier.Core.Submit.DataModificationItemAction DataModificationItemAction { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } - object Entity { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] EntityKey { [CompilerGeneratedAttribute(),]public get; } - string EntitySetName { [CompilerGeneratedAttribute(),]public get; } System.Type ExpectedEntityType { [CompilerGeneratedAttribute(),]public get; } bool IsFullReplaceUpdateRequest { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] LocalValues { [CompilerGeneratedAttribute(),]public get; } System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] OriginalValues { [CompilerGeneratedAttribute(),]public get; } + object Resource { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } + string ResourceSetName { [CompilerGeneratedAttribute(),]public get; } System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] ServerValues { [CompilerGeneratedAttribute(),]public get; } - public System.Linq.IQueryable ApplyEtag (System.Linq.IQueryable query) public System.Linq.IQueryable ApplyTo (System.Linq.IQueryable query) + public object ValidateEtag (System.Linq.IQueryable query) } public class Microsoft.Restier.Core.Submit.DataModificationItem`1 : Microsoft.Restier.Core.Submit.DataModificationItem { - public DataModificationItem`1 (string entitySetName, System.Type expectedEntityType, System.Type actualEntityType, Microsoft.Restier.Core.Submit.DataModificationItemAction action, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] entityKey, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] originalValues, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] localValues) + public DataModificationItem`1 (string resourceSetName, System.Type expectedResourceType, System.Type actualResourceType, Microsoft.Restier.Core.Submit.DataModificationItemAction action, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] entityKey, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] originalValues, System.Collections.Generic.IReadOnlyDictionary`2[[System.String],[System.Object]] localValues) - T Entity { public get; public set; } + T Resource { public get; public set; } } public class Microsoft.Restier.Core.Submit.SubmitContext : Microsoft.Restier.Core.InvocationContext { @@ -530,6 +530,31 @@ public class Microsoft.Restier.Core.Submit.SubmitResult { System.Exception Exception { public get; public set; } } +[ +ExtensionAttribute(), +] +public sealed class Microsoft.Restier.Providers.EntityFramework.GeographyConverter { + [ + ExtensionAttribute(), + ] + public static DbGeography ToDbGeography (Microsoft.Spatial.GeographyLineString lineString) + + [ + ExtensionAttribute(), + ] + public static DbGeography ToDbGeography (Microsoft.Spatial.GeographyPoint point) + + [ + ExtensionAttribute(), + ] + public static Microsoft.Spatial.GeographyLineString ToGeographyLineString (DbGeography geography) + + [ + ExtensionAttribute(), + ] + public static Microsoft.Spatial.GeographyPoint ToGeographyPoint (DbGeography geography) +} + [ CLSCompliantAttribute(), ExtensionAttribute(), @@ -608,31 +633,6 @@ public class Microsoft.Restier.Publishers.OData.RestierPayloadValueConverter : M public virtual object ConvertToPayloadValue (object value, Microsoft.OData.Edm.IEdmTypeReference edmTypeReference) } -[ -ExtensionAttribute(), -] -public sealed class Microsoft.Restier.Providers.EntityFramework.Spatial.GeographyConverter { - [ - ExtensionAttribute(), - ] - public static DbGeography ToDbGeography (Microsoft.Spatial.GeographyLineString lineString) - - [ - ExtensionAttribute(), - ] - public static DbGeography ToDbGeography (Microsoft.Spatial.GeographyPoint point) - - [ - ExtensionAttribute(), - ] - public static Microsoft.Spatial.GeographyLineString ToGeographyLineString (DbGeography geography) - - [ - ExtensionAttribute(), - ] - public static Microsoft.Spatial.GeographyPoint ToGeographyPoint (DbGeography geography) -} - public class Microsoft.Restier.Providers.EntityFramework.Submit.ChangeSetInitializer : IChangeSetInitializer { public ChangeSetInitializer () @@ -664,93 +664,93 @@ public class Microsoft.Restier.Publishers.OData.Batch.RestierBatchHandler : Syst public virtual System.Threading.Tasks.Task`1[[System.Collections.Generic.IList`1[[System.Web.OData.Batch.ODataBatchRequestItem]]]] ParseBatchRequestsAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) } -[ -ExtensionAttribute(), -] -public sealed class Microsoft.Restier.Publishers.OData.Model.ApiConfigurationExtensions { - [ - ExtensionAttribute(), - ] - public static Microsoft.Restier.Core.ApiConfiguration IgnoreProperty (Microsoft.Restier.Core.ApiConfiguration configuration, string propertyName) -} - -[ -AttributeUsageAttribute(), -] -public sealed class Microsoft.Restier.Publishers.OData.Model.OperationAttribute : System.Attribute, _Attribute { - public OperationAttribute () - - string EntitySet { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } - bool HasSideEffects { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } - bool IsBound { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } - bool IsComposable { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } - string Name { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } - string Namespace { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } -} - -[ -EditorBrowsableAttribute(), -ExtensionAttribute(), -] -public sealed class Microsoft.Restier.Publishers.OData.Routing.HttpConfigurationExtensions { - [ - ExtensionAttribute(), - ] - public static System.Threading.Tasks.Task`1[[System.Web.OData.Routing.ODataRoute]] MapRestierRoute (System.Web.Http.HttpConfiguration config, string routeName, string routePrefix, params Microsoft.Restier.Publishers.OData.Batch.RestierBatchHandler batchHandler) - - [ - ExtensionAttribute(), - ] - public static System.Threading.Tasks.Task`1[[System.Web.OData.Routing.ODataRoute]] MapRestierRoute (System.Web.Http.HttpConfiguration config, string routeName, string routePrefix, System.Func`1[[Microsoft.Restier.Core.ApiBase]] apiFactory, params Microsoft.Restier.Publishers.OData.Batch.RestierBatchHandler batchHandler) -} - -public class Microsoft.Restier.Publishers.OData.Formatter.Deserialization.DefaultRestierDeserializerProvider : System.Web.OData.Formatter.Deserialization.DefaultODataDeserializerProvider { +public class Microsoft.Restier.Publishers.OData.Formatter.DefaultRestierDeserializerProvider : System.Web.OData.Formatter.Deserialization.DefaultODataDeserializerProvider { public DefaultRestierDeserializerProvider () public virtual System.Web.OData.Formatter.Deserialization.ODataEdmTypeDeserializer GetEdmTypeDeserializer (Microsoft.OData.Edm.IEdmTypeReference edmType) } -public class Microsoft.Restier.Publishers.OData.Formatter.Serialization.DefaultRestierSerializerProvider : System.Web.OData.Formatter.Serialization.DefaultODataSerializerProvider { +public class Microsoft.Restier.Publishers.OData.Formatter.DefaultRestierSerializerProvider : System.Web.OData.Formatter.Serialization.DefaultODataSerializerProvider { public DefaultRestierSerializerProvider () public virtual System.Web.OData.Formatter.Serialization.ODataEdmTypeSerializer GetEdmTypeSerializer (Microsoft.OData.Edm.IEdmTypeReference edmType) public virtual System.Web.OData.Formatter.Serialization.ODataSerializer GetODataPayloadSerializer (Microsoft.OData.Edm.IEdmModel model, System.Type type, System.Net.Http.HttpRequestMessage request) } -public class Microsoft.Restier.Publishers.OData.Formatter.Serialization.RestierCollectionSerializer : System.Web.OData.Formatter.Serialization.ODataCollectionSerializer { +public class Microsoft.Restier.Publishers.OData.Formatter.RestierCollectionSerializer : System.Web.OData.Formatter.Serialization.ODataCollectionSerializer { public RestierCollectionSerializer (System.Web.OData.Formatter.Serialization.ODataSerializerProvider provider) public virtual void WriteObject (object graph, System.Type type, Microsoft.OData.Core.ODataMessageWriter messageWriter, System.Web.OData.Formatter.Serialization.ODataSerializerContext writeContext) } -public class Microsoft.Restier.Publishers.OData.Formatter.Serialization.RestierComplexTypeSerializer : System.Web.OData.Formatter.Serialization.ODataComplexTypeSerializer { +public class Microsoft.Restier.Publishers.OData.Formatter.RestierComplexTypeSerializer : System.Web.OData.Formatter.Serialization.ODataComplexTypeSerializer { public RestierComplexTypeSerializer (System.Web.OData.Formatter.Serialization.ODataSerializerProvider provider) public virtual void WriteObject (object graph, System.Type type, Microsoft.OData.Core.ODataMessageWriter messageWriter, System.Web.OData.Formatter.Serialization.ODataSerializerContext writeContext) } -public class Microsoft.Restier.Publishers.OData.Formatter.Serialization.RestierEnumSerializer : System.Web.OData.Formatter.Serialization.ODataEnumSerializer { +public class Microsoft.Restier.Publishers.OData.Formatter.RestierEnumSerializer : System.Web.OData.Formatter.Serialization.ODataEnumSerializer { public RestierEnumSerializer () public virtual void WriteObject (object graph, System.Type type, Microsoft.OData.Core.ODataMessageWriter messageWriter, System.Web.OData.Formatter.Serialization.ODataSerializerContext writeContext) } -public class Microsoft.Restier.Publishers.OData.Formatter.Serialization.RestierFeedSerializer : System.Web.OData.Formatter.Serialization.ODataFeedSerializer { +public class Microsoft.Restier.Publishers.OData.Formatter.RestierFeedSerializer : System.Web.OData.Formatter.Serialization.ODataFeedSerializer { public RestierFeedSerializer (System.Web.OData.Formatter.Serialization.ODataSerializerProvider provider) public virtual void WriteObject (object graph, System.Type type, Microsoft.OData.Core.ODataMessageWriter messageWriter, System.Web.OData.Formatter.Serialization.ODataSerializerContext writeContext) } -public class Microsoft.Restier.Publishers.OData.Formatter.Serialization.RestierPrimitiveSerializer : System.Web.OData.Formatter.Serialization.ODataPrimitiveSerializer { +public class Microsoft.Restier.Publishers.OData.Formatter.RestierPrimitiveSerializer : System.Web.OData.Formatter.Serialization.ODataPrimitiveSerializer { public RestierPrimitiveSerializer () public virtual Microsoft.OData.Core.ODataPrimitiveValue CreateODataPrimitiveValue (object graph, Microsoft.OData.Edm.IEdmPrimitiveTypeReference primitiveType, System.Web.OData.Formatter.Serialization.ODataSerializerContext writeContext) public virtual void WriteObject (object graph, System.Type type, Microsoft.OData.Core.ODataMessageWriter messageWriter, System.Web.OData.Formatter.Serialization.ODataSerializerContext writeContext) } -public class Microsoft.Restier.Publishers.OData.Formatter.Serialization.RestierRawSerializer : System.Web.OData.Formatter.Serialization.ODataRawValueSerializer { +public class Microsoft.Restier.Publishers.OData.Formatter.RestierRawSerializer : System.Web.OData.Formatter.Serialization.ODataRawValueSerializer { public RestierRawSerializer () public virtual void WriteObject (object graph, System.Type type, Microsoft.OData.Core.ODataMessageWriter messageWriter, System.Web.OData.Formatter.Serialization.ODataSerializerContext writeContext) } +[ +ExtensionAttribute(), +] +public sealed class Microsoft.Restier.Publishers.OData.Model.ApiConfigurationExtensions { + [ + ExtensionAttribute(), + ] + public static Microsoft.Restier.Core.ApiConfiguration IgnoreProperty (Microsoft.Restier.Core.ApiConfiguration configuration, string propertyName) +} + +[ +AttributeUsageAttribute(), +] +public sealed class Microsoft.Restier.Publishers.OData.Model.OperationAttribute : System.Attribute, _Attribute { + public OperationAttribute () + + string EntitySet { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } + bool HasSideEffects { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } + bool IsBound { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } + bool IsComposable { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } + string Name { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } + string Namespace { [CompilerGeneratedAttribute(),]public get; [CompilerGeneratedAttribute(),]public set; } +} + +[ +EditorBrowsableAttribute(), +ExtensionAttribute(), +] +public sealed class Microsoft.Restier.Publishers.OData.Routing.HttpConfigurationExtensions { + [ + ExtensionAttribute(), + ] + public static System.Threading.Tasks.Task`1[[System.Web.OData.Routing.ODataRoute]] MapRestierRoute (System.Web.Http.HttpConfiguration config, string routeName, string routePrefix, params Microsoft.Restier.Publishers.OData.Batch.RestierBatchHandler batchHandler) + + [ + ExtensionAttribute(), + ] + public static System.Threading.Tasks.Task`1[[System.Web.OData.Routing.ODataRoute]] MapRestierRoute (System.Web.Http.HttpConfiguration config, string routeName, string routePrefix, System.Func`1[[Microsoft.Restier.Core.ApiBase]] apiFactory, params Microsoft.Restier.Publishers.OData.Batch.RestierBatchHandler batchHandler) +} + diff --git a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Extension/CustomizedSubmitProcessor.cs b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Extension/CustomizedSubmitProcessor.cs index da98e06b..6b6ce7e3 100644 --- a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Extension/CustomizedSubmitProcessor.cs +++ b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Extension/CustomizedSubmitProcessor.cs @@ -22,8 +22,8 @@ public Task OnProcessedChangeSetItemAsync(SubmitContext context, ChangeSetItem i var dataModificationItem = item as DataModificationItem; if (dataModificationItem != null) { - object myEntity = dataModificationItem.Entity; - string entitySetName = dataModificationItem.EntitySetName; + object myEntity = dataModificationItem.Resource; + string entitySetName = dataModificationItem.ResourceSetName; DataModificationItemAction operation = dataModificationItem.DataModificationItemAction; // In case of insert, the request URL has no key, and request body may not have key neither as the key may be generated by database