메인 콘텐츠로 건너뛰기
Translation of pages other than English and Japanese versions is maintained by community contributions. The project does not guarantee the accuracy of the content and may not reflect the latest content.

MemoryPack 지원 (Preview)

최종 업데이트

MagicOnion은 메시지 시리얼라이저로 MemoryPack도 지원합니다. (Preview)

dotnet add package MagicOnion.Serialization.MemoryPack

클라이언트와 서버에서 MagicOnionSerializerProviderMemoryPackMagicOnionSerializerProvider를 설정하여 MemoryPack을 사용한 직렬화를 수행할 수 있습니다.

MagicOnionSerializerProvider.Default = MemoryPackMagicOnionSerializerProvider.Instance;

// 또는

await StreamingHubClient.ConnectAsync<IMyHub, IMyHubReceiver>(channel, receiver, serializerProvider: MemoryPackMagicOnionSerializerProvider.Instance);
MagicOnionClient.Create<IMyService>(channel, MemoryPackMagicOnionSerializerProvider.Instance);

MagicOnion.Client.SourceGenerator를 사용하려면 속성에 Serializer = GenerateSerializerType.MemoryPack을 지정해야 합니다. 생성된 코드는 MessagePack 대신 MemoryPack을 사용합니다.

애플리케이션은 시작 시 MagicOnionMemoryPackFormatterProvider.RegisterFormatters()도 호출해야 합니다.