internal static ToRoute IntMetadataRoute(this string metadataName, string defaultValue = null)
{
return metadataName.MapTo<ProjectItemDefinitionElement>(pide => {
foreach(var m in pide.Metadata) {
var metadata = m;
if(metadata.Name == metadataName) {
return new Accessor(() => metadata.Value.ToInt32(), (v) => metadata.Value = v.ToString().ToInt32().ToString());
}
}
var n = pide.AddMetadata(metadataName, defaultValue ?? "");
return new Accessor(() => n.Value.ToInt32(), (v) => n.Value = v.ToString().ToInt32().ToString());
});
}