Skip to content

Commit 829e5d7

Browse files
bulk ops deserialization
1 parent 8cb5575 commit 829e5d7

File tree

60 files changed

+2793
-1147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2793
-1147
lines changed

src/Microsoft.AspNet.OData.Shared/Common/Error.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ internal static ArgumentNullException PropertyNull()
103103
/// Creates an <see cref="ArgumentException"/> with a default message.
104104
/// </summary>
105105
/// <returns>The logged <see cref="Exception"/>.</returns>
106+
[SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly")]
106107
internal static ArgumentException PropertyNullOrWhiteSpace()
107108
{
108109
return new ArgumentException(CommonWebApiResources.PropertyNullOrWhiteSpace, "value");

src/Microsoft.AspNet.OData.Shared/Common/SRResources.Designer.cs

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Microsoft.AspNet.OData.Shared/Common/SRResources.resx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,4 +988,22 @@
988988
<data name="ShouldHaveNavigationPropertyInNavigationExpandPath" xml:space="preserve">
989989
<value>A navigation property expand path should have navigation property in the path.</value>
990990
</data>
991+
<data name="ResourcesShouldbePresent" xml:space="preserve">
992+
<value>ResourceSetWrapper should have ResourceWrappers in it</value>
993+
</data>
994+
<data name="ResourceSetWrapperSupported" xml:space="preserve">
995+
<value>Can only add ResourceWrapper to ResourceSetWrapper</value>
996+
</data>
997+
<data name="ChangedObjectTypeMismatch" xml:space="preserve">
998+
<value>Cannot use Changed Object of type '{0}' on an entity of type '{1}'.</value>
999+
</data>
1000+
<data name="DataModificationException" xml:space="preserve">
1001+
<value>Core.DataModificationException</value>
1002+
</data>
1003+
<data name="ContentID" xml:space="preserve">
1004+
<value>Core.ContentID</value>
1005+
</data>
1006+
<data name="DeltaLinkNotSupported" xml:space="preserve">
1007+
<value>DeltaLinks are not supported</value>
1008+
</data>
9911009
</root>
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
//-----------------------------------------------------------------------------
2+
// <copyright file="MessageType.cs" company=".NET Foundation">
3+
// Copyright (c) .NET Foundation and Contributors. All rights reserved.
4+
// See License.txt in the project root for license information.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
8+
using System;
9+
10+
namespace Org.OData.Core.V1
11+
{
12+
/// <summary>
13+
/// Represents a Message Type.
14+
/// </summary>
15+
public class MessageType
16+
{
17+
/// <summary>
18+
/// Code of message.
19+
/// </summary>
20+
public string Code { get; set; }
21+
22+
/// <summary>
23+
/// Actual message.
24+
/// </summary>
25+
public string Message { get; set; }
26+
27+
/// <summary>
28+
/// Severity of message.
29+
/// </summary>
30+
public string Severity { get; set; }
31+
32+
/// <summary>
33+
/// Target of message.
34+
/// </summary>
35+
public string Target { get; set; }
36+
37+
/// <summary>
38+
/// Details of message.
39+
/// </summary>
40+
public string Details { get; set; }
41+
}
42+
43+
/// <summary>
44+
/// Represents an Exception Type.
45+
/// </summary>
46+
public abstract class ExceptionType
47+
{
48+
/// <summary>
49+
/// Represents a MessageType.
50+
/// </summary>
51+
public MessageType MessageType { get; set; }
52+
}
53+
54+
/// <summary>
55+
/// Represents an Exception for Data modification Operation.
56+
/// </summary>
57+
public class DataModificationExceptionType : ExceptionType
58+
{
59+
/// <summary>
60+
/// Initializes a new instance of the <see cref="DataModificationExceptionType"/> class.
61+
/// </summary>
62+
public DataModificationExceptionType(DataModificationOperationKind failedOperation)
63+
{
64+
this.FailedOperation = failedOperation;
65+
}
66+
67+
/// <summary>
68+
/// Represents the kind of the <see cref="DataModificationOperationKind"/> type of operation.
69+
/// </summary>
70+
public DataModificationOperationKind FailedOperation { get; }
71+
72+
/// <summary>
73+
/// Represents response code.
74+
/// </summary>
75+
public Int16 ResponseCode { get; set; }
76+
}
77+
78+
/// <summary>
79+
/// Enumerates the DataModificationOperation for the operation kind.
80+
/// </summary>
81+
public enum DataModificationOperationKind
82+
{
83+
/// <summary>
84+
/// Insert new Instance.
85+
/// </summary>
86+
Insert,
87+
88+
/// <summary>
89+
/// Update existing Instance.
90+
/// </summary>
91+
Update,
92+
93+
/// <summary>
94+
/// Insert new instance or update it if it already exists.
95+
/// </summary>
96+
Upsert,
97+
98+
/// <summary>
99+
/// Delete existing instance.
100+
/// </summary>
101+
Delete,
102+
103+
/// <summary>
104+
/// Invoke action or function.
105+
/// </summary>
106+
Invoke,
107+
108+
/// <summary>
109+
/// Add link between entities.
110+
/// </summary>
111+
Link,
112+
113+
/// <summary>
114+
/// Remove link between entities.
115+
/// </summary>
116+
Unlink
117+
}
118+
}
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
//-----------------------------------------------------------------------------
2+
// <copyright file="DeltaDeletedEntityObjectOfT.cs" company=".NET Foundation">
3+
// Copyright (c) .NET Foundation and Contributors. All rights reserved.
4+
// See License.txt in the project root for license information.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
8+
using System;
9+
using System.Collections.Generic;
10+
using System.Reflection;
11+
using Microsoft.OData;
12+
using Microsoft.OData.Edm;
13+
14+
namespace Microsoft.AspNet.OData
15+
{
16+
/// <summary>
17+
/// Represents an <see cref="IDeltaDeletedEntityObject"/> with a backing CLR <see cref="Type"/>.
18+
/// Used to hold the Deleted Entry object in the Delta Feed Payload.
19+
/// </summary>
20+
[NonValidatingParameterBinding]
21+
public class DeltaDeletedEntityObject<TStructuralType> : Delta<TStructuralType>, IDeltaDeletedEntityObject where TStructuralType : class
22+
{
23+
/// <summary>
24+
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
25+
/// </summary>
26+
public DeltaDeletedEntityObject()
27+
: this(typeof(TStructuralType))
28+
{
29+
}
30+
31+
/// <summary>
32+
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>
33+
/// </summary>
34+
/// <param name="structuralType">The derived entity type or complex type for which the changes would be tracked.
35+
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
36+
/// </param>
37+
public DeltaDeletedEntityObject(Type structuralType)
38+
: this(structuralType, dynamicDictionaryPropertyInfo: null, instanceAnnotationsPropertyInfo: null)
39+
{
40+
}
41+
42+
/// <summary>
43+
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
44+
/// </summary>
45+
/// <param name="structuralType">The derived entity type or complex type for which the changes would be tracked.
46+
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
47+
/// </param>
48+
/// <param name="updatableProperties">Properties to update</param>
49+
public DeltaDeletedEntityObject(Type structuralType, IEnumerable<string> updatableProperties)
50+
: this(structuralType, updatableProperties, dynamicDictionaryPropertyInfo: null, instanceAnnotationsPropertyInfo: null)
51+
{
52+
53+
}
54+
55+
/// <summary>
56+
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
57+
/// </summary>
58+
/// <param name="structuralType">The derived entity type or complex type for which the changes would be tracked.
59+
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
60+
/// </param>
61+
/// <param name="instanceAnnotationsPropertyInfo">The property info that is used as container for Instance Annotations</param>
62+
public DeltaDeletedEntityObject(Type structuralType, PropertyInfo instanceAnnotationsPropertyInfo)
63+
: this(structuralType, dynamicDictionaryPropertyInfo: null, instanceAnnotationsPropertyInfo)
64+
{
65+
}
66+
67+
/// <summary>
68+
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
69+
/// </summary>
70+
/// <param name="structuralType">The derived entity type or complex type for which the changes would be tracked.
71+
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
72+
/// </param>
73+
/// <param name="dynamicDictionaryPropertyInfo">The property info that is used as dictionary of dynamic
74+
/// properties. <c>null</c> means this entity type is not open.</param>
75+
/// <param name="instanceAnnotationsPropertyInfo">The property info that is used as container for Instance Annotations</param>
76+
public DeltaDeletedEntityObject(Type structuralType, PropertyInfo dynamicDictionaryPropertyInfo, PropertyInfo instanceAnnotationsPropertyInfo)
77+
: this(structuralType, updatableProperties: null, dynamicDictionaryPropertyInfo, instanceAnnotationsPropertyInfo)
78+
{
79+
80+
}
81+
82+
/// <summary>
83+
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
84+
/// </summary>
85+
/// <param name="structuralType">The derived entity type or complex type for which the changes would be tracked.
86+
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
87+
/// </param>
88+
/// <param name="updatableProperties"> Properties that can be updated</param>
89+
/// <param name="dynamicDictionaryPropertyInfo">The property info that is used as dictionary of dynamic
90+
/// properties. <c>null</c> means this entity type is not open.</param>
91+
/// <param name="instanceAnnotationsPropertyInfo">The property info that is used as container for Instance Annotations</param>
92+
public DeltaDeletedEntityObject(Type structuralType, IEnumerable<string> updatableProperties, PropertyInfo dynamicDictionaryPropertyInfo, PropertyInfo instanceAnnotationsPropertyInfo)
93+
: this(structuralType, updatableProperties, dynamicDictionaryPropertyInfo, false, instanceAnnotationsPropertyInfo)
94+
{
95+
96+
}
97+
98+
/// <summary>
99+
/// Initializes a new instance of <see cref="DeltaDeletedEntityObject{TStructuralType}"/>.
100+
/// </summary>
101+
/// <param name="structuralType">The derived entity type or complex type for which the changes would be tracked.
102+
/// <paramref name="structuralType"/> should be assignable to instances of <typeparamref name="TStructuralType"/>.
103+
/// </param>
104+
/// <param name="updatableProperties"> Properties that can be updated</param>
105+
/// <param name="dynamicDictionaryPropertyInfo">The property info that is used as dictionary of dynamic
106+
/// properties. <c>null</c> means this entity type is not open.</param>
107+
/// <param name="isComplexType">To determine if the entity is a complex type</param>
108+
/// <param name="instanceAnnotationsPropertyInfo">The property info that is used as container for Instance Annotations</param>
109+
public DeltaDeletedEntityObject(Type structuralType, IEnumerable<string> updatableProperties, PropertyInfo dynamicDictionaryPropertyInfo, bool isComplexType, PropertyInfo instanceAnnotationsPropertyInfo)
110+
: base(structuralType, updatableProperties, dynamicDictionaryPropertyInfo, isComplexType, instanceAnnotationsPropertyInfo)
111+
{
112+
DeltaKind = EdmDeltaEntityKind.DeletedEntry;
113+
}
114+
115+
/// <inheritdoc />
116+
public Uri Id { get; set; }
117+
118+
/// <inheritdoc />
119+
public DeltaDeletedEntryReason? Reason { get; set; }
120+
121+
/// <inheritdoc />
122+
public IEdmNavigationSource NavigationSource { get; set; }
123+
}
124+
}

0 commit comments

Comments
 (0)