Skip to content

Commit 5158842

Browse files
committed
Add MessagePackIgnoreAttribute to exclude properties. Issue #55 as PR #69
(cherry picked from commit 7e7ce18)
1 parent a50d084 commit 5158842

22 files changed

+1380
-6
lines changed

src/MsgPack.Net35/MsgPack.Net35.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,9 @@
521521
<Compile Include="..\MsgPack\Serialization\MessagePackEnumMemberAttribute.cs">
522522
<Link>Serialization\MessagePackEnumMemberAttribute.cs</Link>
523523
</Compile>
524+
<Compile Include="..\MsgPack\Serialization\MessagePackIgnoreAttribute.cs">
525+
<Link>Serialization\MessagePackIgnoreAttribute.cs</Link>
526+
</Compile>
524527
<Compile Include="..\MsgPack\Serialization\MessagePackMemberAttribute.cs">
525528
<Link>Serialization\MessagePackMemberAttribute.cs</Link>
526529
</Compile>

src/MsgPack.Net40/MsgPack.Net40.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,9 @@
532532
<Compile Include="..\MsgPack\Serialization\MessagePackEnumMemberAttribute.cs">
533533
<Link>Serialization\MessagePackEnumMemberAttribute.cs</Link>
534534
</Compile>
535+
<Compile Include="..\MsgPack\Serialization\MessagePackIgnoreAttribute.cs">
536+
<Link>Serialization\MessagePackIgnoreAttribute.cs</Link>
537+
</Compile>
535538
<Compile Include="..\MsgPack\Serialization\MessagePackMemberAttribute.cs">
536539
<Link>Serialization\MessagePackMemberAttribute.cs</Link>
537540
</Compile>

src/MsgPack.Silverlight.5/MsgPack.Silverlight.5.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,9 @@
523523
<Compile Include="..\MsgPack\Serialization\MessagePackEnumMemberAttribute.cs">
524524
<Link>Serialization\MessagePackEnumMemberAttribute.cs</Link>
525525
</Compile>
526+
<Compile Include="..\MsgPack\Serialization\MessagePackIgnoreAttribute.cs">
527+
<Link>Serialization\MessagePackIgnoreAttribute.cs</Link>
528+
</Compile>
526529
<Compile Include="..\MsgPack\Serialization\MessagePackMemberAttribute.cs">
527530
<Link>Serialization\MessagePackMemberAttribute.cs</Link>
528531
</Compile>

src/MsgPack.Silverlight.WindowsPhone/MsgPack.Silverlight.WindowsPhone.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@
481481
<Compile Include="..\MsgPack\Serialization\MessagePackEnumMemberAttribute.cs">
482482
<Link>Serialization\MessagePackEnumMemberAttribute.cs</Link>
483483
</Compile>
484+
<Compile Include="..\MsgPack\Serialization\MessagePackIgnoreAttribute.cs">
485+
<Link>Serialization\MessagePackIgnoreAttribute.cs</Link>
486+
</Compile>
484487
<Compile Include="..\MsgPack\Serialization\MessagePackMemberAttribute.cs">
485488
<Link>Serialization\MessagePackMemberAttribute.cs</Link>
486489
</Compile>

src/MsgPack.Unity3D/MsgPack.Unity3D.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@
363363
<Compile Include="..\MsgPack\Serialization\MessagePackEnumMemberAttribute.cs">
364364
<Link>Serialization\MessagePackEnumMemberAttribute.cs</Link>
365365
</Compile>
366+
<Compile Include="..\MsgPack\Serialization\MessagePackIgnoreAttribute.cs">
367+
<Link>Serialization\MessagePackIgnoreAttribute.cs</Link>
368+
</Compile>
366369
<Compile Include="..\MsgPack\Serialization\MessagePackMemberAttribute.cs">
367370
<Link>Serialization\MessagePackMemberAttribute.cs</Link>
368371
</Compile>

src/MsgPack.WinRT.Portable/MsgPack.WinRT.Portable.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@
424424
<Compile Include="..\MsgPack\Serialization\MessagePackEnumMemberAttribute.cs">
425425
<Link>Serialization\MessagePackEnumMemberAttribute.cs</Link>
426426
</Compile>
427+
<Compile Include="..\MsgPack\Serialization\MessagePackIgnoreAttribute.cs">
428+
<Link>Serialization\MessagePackIgnoreAttribute.cs</Link>
429+
</Compile>
427430
<Compile Include="..\MsgPack\Serialization\MessagePackMemberAttribute.cs">
428431
<Link>Serialization\MessagePackMemberAttribute.cs</Link>
429432
</Compile>

src/MsgPack.Xamarin.Android/MsgPack.Xamarin.Android.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@
355355
<Compile Include="..\MsgPack\Serialization\MessagePackEnumMemberAttribute.cs">
356356
<Link>Serialization\MessagePackEnumMemberAttribute.cs</Link>
357357
</Compile>
358+
<Compile Include="..\MsgPack\Serialization\MessagePackIgnoreAttribute.cs">
359+
<Link>Serialization\MessagePackIgnoreAttribute.cs</Link>
360+
</Compile>
358361
<Compile Include="..\MsgPack\Serialization\MessagePackMemberAttribute.cs">
359362
<Link>Serialization\MessagePackMemberAttribute.cs</Link>
360363
</Compile>

src/MsgPack.Xamarin.iOS/MsgPack.Xamarin.iOS.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@
359359
<Compile Include="..\MsgPack\Serialization\MessagePackEnumMemberAttribute.cs">
360360
<Link>Serialization\MessagePackEnumMemberAttribute.cs</Link>
361361
</Compile>
362+
<Compile Include="..\MsgPack\Serialization\MessagePackIgnoreAttribute.cs">
363+
<Link>Serialization\MessagePackIgnoreAttribute.cs</Link>
364+
</Compile>
362365
<Compile Include="..\MsgPack\Serialization\MessagePackMemberAttribute.cs">
363366
<Link>Serialization\MessagePackMemberAttribute.cs</Link>
364367
</Compile>

src/MsgPack/MsgPack.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
<Compile Include="Serialization\CollectionDetailedKind.cs" />
168168
<Compile Include="Serialization\INilImplicationHandlerOnUnpackedParameter.cs" />
169169
<Compile Include="Serialization\INilImplicationHandlerParameter.cs" />
170+
<Compile Include="Serialization\MessagePackIgnoreAttribute.cs" />
170171
<Compile Include="Serialization\NilImplicationHandler`4.cs" />
171172
<Compile Include="Serialization\ReflectionSerializers\ReflectionCollectionSerializer.cs" />
172173
<Compile Include="Serialization\ReflectionSerializers\ReflectionNilImplicationHandler.cs" />
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#region -- License Terms --
2+
//
3+
// MessagePack for CLI
4+
//
5+
// Copyright (C) 2014 FUJIWARA, Yusuke
6+
//
7+
// Licensed under the Apache License, Version 2.0 (the "License");
8+
// you may not use this file except in compliance with the License.
9+
// You may obtain a copy of the License at
10+
//
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
18+
//
19+
// Contributors:
20+
// Takeshi KIRIYA
21+
//
22+
#endregion -- License Terms --
23+
24+
using System;
25+
26+
namespace MsgPack.Serialization
27+
{
28+
/// <summary>
29+
/// Marks the field or the property should not be serialized/deserialized with MessagePack for CLI serialization mechanism.
30+
/// </summary>
31+
[AttributeUsage( AttributeTargets.Field | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
32+
public sealed class MessagePackIgnoreAttribute : Attribute
33+
{
34+
/// <summary>
35+
/// Initializes a new instance of the <see cref="MessagePackIgnoreAttribute"/> class.
36+
/// </summary>
37+
public MessagePackIgnoreAttribute() { }
38+
}
39+
}

0 commit comments

Comments
 (0)