Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
// </copyright>
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.AspNet.OData.Builder
{
/// <summary>
/// Interface to used as a Container for holding Instance Annotations, An default implementation is provided
/// Custoer can implement the interface and can have their own implementation.
/// Identifies a container for holding instance annotations. A default implementation is provided.
/// Customers can have their own implementation.
/// </summary>
public interface IODataInstanceAnnotationContainer
{
Expand Down
1 change: 1 addition & 0 deletions src/Microsoft.AspNet.OData.Shared/Common/Error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ internal static ArgumentNullException PropertyNull()
/// Creates an <see cref="ArgumentException"/> with a default message.
/// </summary>
/// <returns>The logged <see cref="Exception"/>.</returns>
[SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly")]
internal static ArgumentException PropertyNullOrWhiteSpace()
{
return new ArgumentException(CommonWebApiResources.PropertyNullOrWhiteSpace, "value");
Expand Down
66 changes: 66 additions & 0 deletions src/Microsoft.AspNet.OData.Shared/Common/SRResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions src/Microsoft.AspNet.OData.Shared/Common/SRResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -988,4 +988,22 @@
<data name="ShouldHaveNavigationPropertyInNavigationExpandPath" xml:space="preserve">
<value>A navigation property expand path should have navigation property in the path.</value>
</data>
<data name="ResourcesShouldbePresent" xml:space="preserve">
<value>ResourceSetWrapper should have ResourceWrappers in it</value>
</data>
<data name="ResourceSetWrapperSupported" xml:space="preserve">
<value>Can only add ResourceWrapper to ResourceSetWrapper</value>
</data>
<data name="ChangedObjectTypeMismatch" xml:space="preserve">
<value>Cannot use Changed Object of type '{0}' on an entity of type '{1}'.</value>
</data>
<data name="DataModificationException" xml:space="preserve">
<value>Core.DataModificationException</value>
</data>
<data name="ContentID" xml:space="preserve">
<value>Core.ContentID</value>
</data>
<data name="DeltaLinkNotSupported" xml:space="preserve">
<value>DeltaLinks are not supported</value>
</data>
</root>
118 changes: 118 additions & 0 deletions src/Microsoft.AspNet.OData.Shared/DataModificationExceptionType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
//-----------------------------------------------------------------------------
// <copyright file="MessageType.cs" company=".NET Foundation">
// Copyright (c) .NET Foundation and Contributors. All rights reserved.
// See License.txt in the project root for license information.
// </copyright>
//------------------------------------------------------------------------------

using System;

namespace Org.OData.Core.V1
{
Comment thread
ElizabethOkerio marked this conversation as resolved.
/// <summary>
/// Represents a message type.
/// </summary>
public class MessageType
{
/// <summary>
/// Code of message.
/// </summary>
public string Code { get; set; }

/// <summary>
/// Actual message.
/// </summary>
public string Message { get; set; }

/// <summary>
/// Severity of message.
/// </summary>
public string Severity { get; set; }

/// <summary>
/// Target of message.
/// </summary>
public string Target { get; set; }

/// <summary>
/// Details of message.
/// </summary>
public string Details { get; set; }
}

/// <summary>
/// Represents an exception type.
/// </summary>
public abstract class ExceptionType
{
/// <summary>
/// Represents a message type.
/// </summary>
public MessageType MessageType { get; set; }
}

/// <summary>
/// Represents the type of exception thrown during a data modification operation.
/// </summary>
public class DataModificationExceptionType : ExceptionType
{
/// <summary>
/// Initializes a new instance of the <see cref="DataModificationExceptionType"/> class.
/// </summary>
public DataModificationExceptionType(DataModificationOperationKind failedOperation)
{
this.FailedOperation = failedOperation;
}

/// <summary>
/// Represents the kind of data modification operation.
/// </summary>
public DataModificationOperationKind FailedOperation { get; }

/// <summary>
/// Represents the response code.
/// </summary>
public Int16 ResponseCode { get; set; }
}

/// <summary>
/// Enumerates the kind of data modification operations.
/// </summary>
public enum DataModificationOperationKind
{
/// <summary>
/// Represents an insert operation.
/// </summary>
Insert,

/// <summary>
/// Represents an update operation.
/// </summary>
Update,

/// <summary>
/// Represents an insert or update operation if item already exists.
/// </summary>
Upsert,

/// <summary>
/// Represents a delete data modification operation.
/// </summary>
Delete,

/// <summary>
/// Represents an action or function invocation.
/// </summary>
Invoke,

/// <summary>
/// Represents adding a link between entities.
/// </summary>
Link,

/// <summary>
/// Represents removing a link between entities.
/// </summary>
Unlink
}
}
120 changes: 120 additions & 0 deletions src/Microsoft.AspNet.OData.Shared/DeltaDeletedEntityObjectOfT.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
//-----------------------------------------------------------------------------
// <copyright file="DeltaDeletedEntityObjectOfT.cs" company=".NET Foundation">
// Copyright (c) .NET Foundation and Contributors. All rights reserved.
// See License.txt in the project root for license information.
// </copyright>
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.OData;

namespace Microsoft.AspNet.OData
{
/// <summary>
/// Represents an <see cref="IDeltaDeletedEntityObject"/> with a backing CLR type.
/// Used to hold the deleted entry object in the delta feed payload.
/// </summary>
[NonValidatingParameterBinding]
Comment thread
ElizabethOkerio marked this conversation as resolved.
public class DeltaDeletedEntityObject<TStructuralType> : Delta<TStructuralType>, IDeltaDeletedEntityObject where TStructuralType : class
Comment thread
ElizabethOkerio marked this conversation as resolved.
{
/// <summary>
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
/// </summary>
public DeltaDeletedEntityObject()
: this(typeof(TStructuralType))
{
}

/// <summary>
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>
/// </summary>
/// <param name="structuralType">The derived entity type or complex type for which the changes will be tracked.
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
/// </param>
public DeltaDeletedEntityObject(Type structuralType)
: this(structuralType, dynamicDictionaryPropertyInfo: null, instanceAnnotationsPropertyInfo: null)
{
}

/// <summary>
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
/// </summary>
/// <param name="structuralType">The derived entity type or complex type for which the changes will be tracked.
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
/// </param>
/// <param name="updatableProperties">Properties that can be updated.</param>
public DeltaDeletedEntityObject(Type structuralType, IEnumerable<string> updatableProperties)
: this(structuralType, updatableProperties, dynamicDictionaryPropertyInfo: null, instanceAnnotationsPropertyInfo: null)
{
}

/// <summary>
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
/// </summary>
/// <param name="structuralType">The derived entity type or complex type for which the changes will be tracked.
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
/// </param>
/// <param name="instanceAnnotationsPropertyInfo">The property info that is used as container for instance annotations</param>
public DeltaDeletedEntityObject(Type structuralType, PropertyInfo instanceAnnotationsPropertyInfo)
: this(structuralType, dynamicDictionaryPropertyInfo: null, instanceAnnotationsPropertyInfo)
{
}

/// <summary>
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
/// </summary>
/// <param name="structuralType">The derived entity type or complex type for which the changes will be tracked.
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
/// </param>
/// <param name="dynamicDictionaryPropertyInfo">The property info that is used as dictionary of dynamic
/// properties. <c>null</c> means this entity type is not open.</param>
/// <param name="instanceAnnotationsPropertyInfo">The property info that is used as container for instance annotations</param>
public DeltaDeletedEntityObject(Type structuralType, PropertyInfo dynamicDictionaryPropertyInfo, PropertyInfo instanceAnnotationsPropertyInfo)
: this(structuralType, updatableProperties: null, dynamicDictionaryPropertyInfo, instanceAnnotationsPropertyInfo)
{
}

/// <summary>
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
/// </summary>
/// <param name="structuralType">The derived entity type or complex type for which the changes will be tracked.
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
/// </param>
/// <param name="updatableProperties">Properties that can be updated.</param>
/// <param name="dynamicDictionaryPropertyInfo">The property info that is used as dictionary of dynamic
/// properties. <c>null</c> means this entity type is not open.</param>
/// <param name="instanceAnnotationsPropertyInfo">The property info that is used as container for instance annotations</param>
public DeltaDeletedEntityObject(Type structuralType, IEnumerable<string> updatableProperties, PropertyInfo dynamicDictionaryPropertyInfo, PropertyInfo instanceAnnotationsPropertyInfo)
: this(structuralType, updatableProperties, dynamicDictionaryPropertyInfo, false, instanceAnnotationsPropertyInfo)
{
}

/// <summary>
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
/// </summary>
/// <param name="structuralType">The derived entity type or complex type for which the changes will be tracked.
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
/// </param>
/// <param name="updatableProperties">Properties that can be updated.</param>
/// <param name="dynamicDictionaryPropertyInfo">The property info that is used as dictionary of dynamic
/// properties. <c>null</c> means this entity type is not open.</param>
/// <param name="isComplexType">To determine if the entity is a complex type</param>
/// <param name="instanceAnnotationsPropertyInfo">The property info that is used as container for instance annotations</param>
public DeltaDeletedEntityObject(Type structuralType, IEnumerable<string> updatableProperties, PropertyInfo dynamicDictionaryPropertyInfo, bool isComplexType, PropertyInfo instanceAnnotationsPropertyInfo)
: base(structuralType, updatableProperties, dynamicDictionaryPropertyInfo, isComplexType, instanceAnnotationsPropertyInfo)
{
DeltaKind = EdmDeltaEntityKind.DeletedEntry;
}

/// <inheritdoc />
public Uri Id { get; set; }

/// <inheritdoc />
public DeltaDeletedEntryReason? Reason { get; set; }

/// <inheritdoc />
public string NavigationSource { get; set; }
}
}
Loading