Make MessagePack [Key] the slot authority and pin generic resolvers
.cc is MessagePack-based, so the core no longer pretends to be serializer-independent. GameCult.Caching references MessagePack.Annotations 3.1.7 and reads KeyAttribute and IgnoreMemberAttribute by type instead of matching their names. The benchmark's own MessagePack.Annotations reference is dropped; it arrives through GameCult.Caching. A generic document's options come from its generic definition's assembly: Doc<X> uses Doc's declared resolvers, never X's. GenericDocumentUsesItsOwnAssemblyResolvers compiles GenericHolder<T> into an assembly whose resolver writes Pair as [B, A] and checks the payload uses it rather than Pair's own assembly resolver. Contracts: schema-compatibility states the slot rule and its rejections; store-composition states the generic resolver rule. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
7c4bc2bdc0
commit
30bf7fd267
6 changed files with 82 additions and 24 deletions
|
|
@ -1021,32 +1021,13 @@ namespace GameCult.Caching
|
|||
private static string HiddenMemberMessage(string documentTypeName, string first, string second) =>
|
||||
$"Cult document {documentTypeName} member {first} hides persisted member {second}; persisted member names must be unique.";
|
||||
|
||||
private static bool IsIgnored(MemberInfo member)
|
||||
{
|
||||
return member.GetCustomAttributes().Any(attribute =>
|
||||
{
|
||||
var name = attribute.GetType().FullName;
|
||||
return name == "MessagePack.IgnoreMemberAttribute";
|
||||
});
|
||||
}
|
||||
private static bool IsIgnored(MemberInfo member) =>
|
||||
member.GetCustomAttribute<global::MessagePack.IgnoreMemberAttribute>() != null;
|
||||
|
||||
private static object? GetKeyValue(MemberInfo member)
|
||||
{
|
||||
foreach (var attribute in member.GetCustomAttributes())
|
||||
{
|
||||
var name = attribute.GetType().FullName;
|
||||
if (name == "MessagePack.KeyAttribute")
|
||||
{
|
||||
if (attribute.GetType().GetProperty("IntKey")?.GetValue(attribute) is int intKey)
|
||||
{
|
||||
return intKey;
|
||||
}
|
||||
|
||||
return attribute.GetType().GetProperty("StringKey")?.GetValue(attribute) as string;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
var key = member.GetCustomAttribute<global::MessagePack.KeyAttribute>();
|
||||
return key?.IntKey is int slot ? slot : key?.StringKey;
|
||||
}
|
||||
|
||||
private static string Sha256(string input)
|
||||
|
|
|
|||
Loading…
Reference in a new issue