예제 #1
0
        public static Asset SetMetadata(this Asset asset, AssetMetadata metadata)
        {
            string name = AssetMetadataManager.Default.GetMetadataName(metadata.GetType());

            if (asset.Metaddata.TryAdd(name, metadata) == false)
            {
                asset.Metaddata[name] = metadata;
            }

            return(asset);
        }
 public RenderFragment CreateMetadataComponent(AssetMetadata metadata)
 {
     if (_cacheView.TryGetValue(metadata.GetType(), out Type viewType))
     {
         return(builder =>
         {
             builder.OpenComponent(0, viewType);
             builder.AddAttribute(0, nameof(IAssetMetadataComponent.Metadata), metadata);
             builder.CloseComponent();
         });
     }
     else
     {
         return(builder => { builder.OpenElement(0, "p"); builder.AddContent(0, "no metadata available"); builder.CloseElement(); });
     }
 }