-
-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.3.0, add MessagePackFormatterAttribute
- Loading branch information
Showing
15 changed files
with
293 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
nuget push MessagePack.1.2.3.nupkg -Source https://www.nuget.org/api/v2/package | ||
nuget push MessagePack.ImmutableCollection.1.2.3.nupkg -Source https://www.nuget.org/api/v2/package | ||
nuget push MessagePack.ReactiveProperty.1.2.3.nupkg -Source https://www.nuget.org/api/v2/package | ||
nuget push MessagePack.UnityShims.1.2.3.nupkg -Source https://www.nuget.org/api/v2/package | ||
nuget push MessagePack.AspNetCoreMvcFormatter.1.2.3.nupkg -Source https://www.nuget.org/api/v2/package | ||
nuget push MessagePack.1.3.0.nupkg -Source https://www.nuget.org/api/v2/package | ||
nuget push MessagePack.ImmutableCollection.1.3.0.nupkg -Source https://www.nuget.org/api/v2/package | ||
nuget push MessagePack.ReactiveProperty.1.3.0.nupkg -Source https://www.nuget.org/api/v2/package | ||
nuget push MessagePack.UnityShims.1.3.0.nupkg -Source https://www.nuget.org/api/v2/package | ||
nuget push MessagePack.AspNetCoreMvcFormatter.1.3.0.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="MessagePack" version="1.2.3" targetFramework="net461" /> | ||
<package id="MessagePack" version="1.3.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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using MessagePack.Formatters; | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace MessagePack.Resolvers | ||
{ | ||
/// <summary> | ||
/// Get formatter from [MessaegPackFromatter] attribute. | ||
/// </summary> | ||
public class AttributeFormatterResolver : IFormatterResolver | ||
{ | ||
public static IFormatterResolver Instance = new AttributeFormatterResolver(); | ||
|
||
AttributeFormatterResolver() | ||
{ | ||
|
||
} | ||
|
||
public IMessagePackFormatter<T> GetFormatter<T>() | ||
{ | ||
return FormatterCache<T>.formatter; | ||
} | ||
|
||
static class FormatterCache<T> | ||
{ | ||
public static readonly IMessagePackFormatter<T> formatter; | ||
|
||
static FormatterCache() | ||
{ | ||
var attr = typeof(T).GetTypeInfo().GetCustomAttribute<MessagePackFormatterAttribute>(); | ||
if (attr == null) | ||
{ | ||
return; | ||
} | ||
|
||
formatter = (IMessagePackFormatter<T>)Activator.CreateInstance(attr.FormatterType); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.