我正在为JSON-LD编写上下文文件(.json)。我知道别名→谓词映射是一对一的,也就是说,每个别名(显然)都映射到正好一个谓词。但这又是另一种方式吗?还是可以定义两个不同的别名来描述相同的谓词?
这只是为了使JSON-LD更具可读性和直观性。
这就是我想要做的:
[Export(typeof(CodeGeneratorFactory))]
public class ModuleScaffolderFactory : CodeGeneratorFactory
{
public ModuleScaffolderFactory()
: base(CreateCodeGeneratorInformation())
{
}
public override ICodeGenerator CreateInstance(CodeGenerationContext context)
{
return new ModuleScaffolder(context, Information);
}
// We support CSharp WAPs targetting at least .Net Framework 4.5 or above.
// We DON'T currently support VB
public override bool IsSupported(CodeGenerationContext codeGenerationContext)
{
if (ProjectLanguage.CSharp.Equals(codeGenerationContext.ActiveProject.GetCodeLanguage()))
{
FrameworkName targetFramework = codeGenerationContext.ActiveProject.GetTargetFramework();
if (targetFramework != null)
{
return String.Equals(".NetFramework", targetFramework.Identifier, StringComparison.OrdinalIgnoreCase) &&
targetFramework.Version >= new Version(4, 5);
}
}
return true;
}
private static CodeGeneratorInformation CreateCodeGeneratorInformation()
{
return new CodeGeneratorInformation(
displayName: "[Platform]添加模块功能(Hplus)",
description: "通过实体类,生成相应模块的Core层和Application层代码",
author: "yanusosu",
version: new Version(0, 1, 0, 0),
id: "Yanusosu_Platform_Scaffolding",
icon: ToImageSource(Resources.Application),
gestures: new[] { "Yanusosu" },
categories: new[] { "Yanusosu", Categories.Common, Categories.Other }
);
}
/// <summary>
/// Helper method to convert Icon to Imagesource.
/// </summary>
/// <param name="icon">Icon</param>
/// <returns>Imagesource</returns>
public static ImageSource ToImageSource(Icon icon)
{
ImageSource imageSource = Imaging.CreateBitmapSourceFromHIcon(
icon.Handle,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
return imageSource;
}
}
我认为它应该可以工作,但是我想听听之前确实已经做过的人的声音。
答案 0 :(得分:0)
根据spec看来确实有可能!?
即使有可能,也不要这样做!