This commit is contained in:
neuecc 2017-06-29 16:32:30 +09:00
Родитель d857f75622
Коммит 342248043a
15 изменённых файлов: 73 добавлений и 38 удалений

Просмотреть файл

@ -206,6 +206,14 @@ I don't need type, I want to use like BinaryFormatter! You can use as typeless r
Resolver is key customize point of MessagePack for C#. Details, please see [extension point](https://github.com/neuecc/MessagePack-CSharp#extension-pointiformatterresolver).
DataContract compatibility
---
You can use `[DataContract]` instead of `[MessagePackObject]`. If type is marked DataContract, you can use `[DataMember]` instead of `[Key]` and `[Ignore]` instead of `[IgnoreDataMember]`.
`[DataMember(Order = int)]` is same as `[Key(int)]`, `[DataMember(Name = string)]` is same as `[Key(string)]`. If use `[DataMember]`, same as `[Key(nameof(propertyname)]`.
Using DataContract makes it a shared class library and you do not have to refer to MessagePack for C#. However, it is not included in analysis by Analyzer or code generation by `mpc.exe`. Also, functions like `UnionAttribute`, `MessagePackFormatterAttribute`, `SerializationConstructorAttribute` etc can not be used. For this reason, I recommend that you use the MessagePack for C# attribute basically.
Serialize ImmutableObject(SerializationConstructor)
---
MessagePack for C# supports deserialize immutable object. For example, this struct can serialize/deserialize naturally.
@ -934,6 +942,20 @@ public class CustomObject
Formatter is retrieved by `AttributeFormatterResolver`, it is included in `StandardResolver`.
Reserved Extension Types
---
MessagePack for C# already used some messagepack ext type codes, be careful to use same ext code.
| Resovler Name | Description |
| --- | --- |
| BuiltinResolver | Builtin primitive and standard classes resolver. It includes primitive(int, bool, string...) and there nullable, array and list. and some extra builtin types(Guid, Uri, BigInteger, etc...). |
| StandardResolver | Composited resolver. It resolves in the following order `builtin -> attribute -> dynamic enum -> dynamic generic -> dynamic union -> dynamic object -> primitive object`. This is the default of MessagePackSerializer. |
| ContractlessStandardResolver | Composited `StandardResolver`(except primitive) -> `DynamicContractlessObjectResolver` -> `DynamicObjectTypeFallbackResolver`. It enables contractless serialization. |
| PrimitiveObjectResolver | MessagePack primitive object resolver. It is used fallback in `object` type and supports `bool`, `char`, `sbyte`, `byte`, `short`, `int`, `long`, `ushort`, `uint`, `ulong`, `float`, `double`, `DateTime`, `string`, `byte[]`, `ICollection`, `IDictionary`. |
| DynamicObjectTypeFallbackResolver | It is used fallback in `object` type and resolve primitive object -> dynamic contractless object |
| AttributeFormatterResolver | Get formatter from `[MessagePackFormatter]` attribute. |
for Unity
---
You can install by package and includes source code. If build target as PC, you can use as is but if build target uses IL2CPP, you can not use `Dynamic***Resolver` so use pre-code generation. Please see [pre-code generation section](https://github.com/neuecc/MessagePack-CSharp#pre-code-generationunityxamarin-supports).

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MessagePack.AspNetCoreMvcFormatter</id>
<version>1.4.0</version>
<version>1.4.1</version>
<title>ASP.NET Core MVC Input/Output MessagePack formatter</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
@ -13,7 +13,7 @@
<tags>MsgPack, MessagePack, Serialization, Formatter, Serializer, aspnetcore, aspnetcoremvc</tags>
<dependencies>
<group targetFramework=".NETStandard1.4">
<dependency id="MessagePack" version="1.4.0" />
<dependency id="MessagePack" version="1.4.1" />
<dependency id="Microsoft.AspNetCore.Mvc.Abstractions" version="1.2.0" />
</group>
</dependencies>

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MessagePack.ImmutableCollection</id>
<version>1.4.0</version>
<version>1.4.1</version>
<title>MessagePack for C# Extension Support for ImmutableCollection</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
@ -17,15 +17,15 @@
</frameworkAssemblies>
<dependencies>
<group targetFramework=".NETFramework4.7">
<dependency id="MessagePack" version="1.4.0" />
<dependency id="MessagePack" version="1.4.1" />
<dependency id="System.Collections.Immutable" version="1.3.1" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="MessagePack" version="1.4.0" />
<dependency id="MessagePack" version="1.4.1" />
<dependency id="System.Collections.Immutable" version="1.3.1" />
</group>
<group targetFramework=".NETStandard1.4">
<dependency id="MessagePack" version="1.4.0" />
<dependency id="MessagePack" version="1.4.1" />
<dependency id="System.Collections.Immutable" version="1.3.1" />
</group>
</dependencies>

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MessagePack.ReactiveProperty</id>
<version>1.4.0</version>
<version>1.4.1</version>
<title>MessagePack for C# Extension Support for ReactiveProperty</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
@ -17,15 +17,15 @@
</frameworkAssemblies>
<dependencies>
<group targetFramework=".NETFramework4.7">
<dependency id="MessagePack" version="1.4.0" />
<dependency id="MessagePack" version="1.4.1" />
<dependency id="ReactiveProperty" version="3.5.1" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="MessagePack" version="1.4.0" />
<dependency id="MessagePack" version="1.4.1" />
<dependency id="ReactiveProperty" version="3.5.1" />
</group>
<group targetFramework=".NETStandard1.4">
<dependency id="MessagePack" version="1.4.0" />
<dependency id="MessagePack" version="1.4.1" />
<dependency id="ReactiveProperty" version="3.5.1" />
</group>
</dependencies>

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MessagePack.UnityShims</id>
<version>1.4.0</version>
<version>1.4.1</version>
<title>MessagePack for C# Extension Support for Unity(add pseudo Vector type and fast Vectory[] extension formatter)</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
@ -17,13 +17,13 @@
</frameworkAssemblies>
<dependencies>
<group targetFramework=".NETFramework4.7">
<dependency id="MessagePack" version="1.4.0" />
<dependency id="MessagePack" version="1.4.1" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="MessagePack" version="1.4.0" />
<dependency id="MessagePack" version="1.4.1" />
</group>
<group targetFramework=".NETStandard1.4">
<dependency id="MessagePack" version="1.4.0" />
<dependency id="MessagePack" version="1.4.1" />
</group>
</dependencies>
</metadata>

Просмотреть файл

@ -2,14 +2,14 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MessagePack</id>
<version>1.4.0</version>
<version>1.4.1</version>
<title>MessagePack for C#</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
<projectUrl>https://github.com/neuecc/MessagePack-CSharp/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Extremely Fast MessagePack(MsgPack) Serializer for C#(.NET, .NET Core, Unity, Xamarin).</description>
<releaseNotes>Add Stream API.</releaseNotes>
<releaseNotes>Add DataCotnract support.</releaseNotes>
<tags>MsgPack, MessagePack, Serialization, Formatter, Serializer, Unity, Xamarin</tags>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System" targetFramework=".NETFramework4.5" />

Просмотреть файл

@ -1,6 +1,6 @@
nuget push MessagePack.1.4.0.nupkg -Source https://www.nuget.org/api/v2/package
nuget push MessagePack.ImmutableCollection.1.4.0.nupkg -Source https://www.nuget.org/api/v2/package
nuget push MessagePack.ReactiveProperty.1.4.0.nupkg -Source https://www.nuget.org/api/v2/package
nuget push MessagePack.UnityShims.1.4.0.nupkg -Source https://www.nuget.org/api/v2/package
nuget push MessagePack.AspNetCoreMvcFormatter.1.4.0.nupkg -Source https://www.nuget.org/api/v2/package
nuget push MessagePack.1.4.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push MessagePack.ImmutableCollection.1.4.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push MessagePack.ReactiveProperty.1.4.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push MessagePack.UnityShims.1.4.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push MessagePack.AspNetCoreMvcFormatter.1.4.1.nupkg -Source https://www.nuget.org/api/v2/package
REM nuget push MessagePackAnalyzer.1.6.0.nupkg -Source https://www.nuget.org/api/v2/package

Просмотреть файл

@ -798,7 +798,7 @@ public class ArrayTestTest
[MessagePackObject(true)]
public class ComplexModel
{
public IDictionary<string, string> AdditionalProperty { get; } = new Dictionary<string, string>();
public IDictionary<string, string> AdditionalProperty { get; private set; }
public DateTimeOffset CreatedOn { get; set; }
@ -808,7 +808,13 @@ public class ComplexModel
public DateTimeOffset UpdatedOn { get; set; }
public IList<SimpleModel> SimpleModels { get; } = new List<SimpleModel>();
public IList<SimpleModel> SimpleModels { get; private set; }
public ComplexModel()
{
AdditionalProperty = new Dictionary<string, string>();
SimpleModels = new List<SimpleModel>();
}
}
[MessagePackObject(true)]
@ -823,7 +829,12 @@ public class SimpleModel
public DateTime CreatedOn { get; set; }
public int Precision { get; set; } = 4;
public int Precision { get; set; }
public SimpleModel()
{
Precision = 4;
}
public decimal Money
{

Просмотреть файл

@ -33,9 +33,6 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="MessagePack, Version=1.4.0.0, Culture=neutral, PublicKeyToken=b4a0369545f0a1be, processorArchitecture=MSIL">
<HintPath>..\..\packages\MessagePack.1.4.0\lib\net45\MessagePack.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@ -56,5 +53,11 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\MessagePack\MessagePack.csproj">
<Project>{7abb33ee-a2f1-492b-8daf-5df89f0f0b79}</Project>
<Name>MessagePack</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MessagePack" version="1.4.0" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.ValueTuple" version="4.3.0" targetFramework="net461" />
</packages>

Просмотреть файл

@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: Guid("7c1f59ed-3929-4cbb-8aca-b13139fbca3a")]
[assembly: AssemblyVersion("1.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]
[assembly: AssemblyVersion("1.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]

Просмотреть файл

@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: Guid("fe5a979e-24c6-47dd-919f-81df6fb2e160")]
[assembly: AssemblyVersion("1.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]
[assembly: AssemblyVersion("1.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]

Просмотреть файл

@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: Guid("16b0640a-c86d-4f21-bf2f-45efc728ae96")]
[assembly: AssemblyVersion("1.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]
[assembly: AssemblyVersion("1.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]

Просмотреть файл

@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: Guid("4b074f49-f7cb-4885-9a58-cc75a7d64b62")]
[assembly: AssemblyVersion("1.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]
[assembly: AssemblyVersion("1.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]

Просмотреть файл

@ -11,5 +11,5 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: Guid("b23e464e-0ac2-47c9-9520-ea98cbb99575")]
[assembly: AssemblyVersion("1.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]
[assembly: AssemblyVersion("1.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]