Honor schema aliases in store publications
This commit is contained in:
parent
b1fcd95c25
commit
267ff356ea
1 changed files with 10 additions and 3 deletions
|
|
@ -3315,9 +3315,16 @@ namespace GameCult.Mesh
|
|||
private static TDocument ReadRequired<TDocument>(CultCache cache, CultRecordKey key)
|
||||
where TDocument : class
|
||||
{
|
||||
return cache.Get<TDocument>(key)
|
||||
?? throw new KeyNotFoundException(
|
||||
$"CultMesh document '{key.Value}' was not found as {typeof(TDocument).FullName}.");
|
||||
var document = cache.Get<TDocument>(key);
|
||||
if (document != null)
|
||||
return document;
|
||||
|
||||
var untyped = cache.Get(key);
|
||||
if (untyped != null && IsSameCultDocumentSchema<TDocument>(untyped.GetType()))
|
||||
return ConvertUntypedDocument<TDocument>(untyped);
|
||||
|
||||
throw new KeyNotFoundException(
|
||||
$"CultMesh document '{key.Value}' was not found as {typeof(TDocument).FullName}.");
|
||||
}
|
||||
|
||||
private static async Task<TDocument> ReadRequiredAsync<TDocument>(
|
||||
|
|
|
|||
Loading…
Reference in a new issue