Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Azure/RIA/Silverlight应用程序中的本地化数据批注问题_C#_Silverlight_Localization_Azure_Wcf Ria Services - Fatal编程技术网

C# Azure/RIA/Silverlight应用程序中的本地化数据批注问题

C# Azure/RIA/Silverlight应用程序中的本地化数据批注问题,c#,silverlight,localization,azure,wcf-ria-services,C#,Silverlight,Localization,Azure,Wcf Ria Services,我很难在Azure/RIA/Silverlight应用程序中创建本地化数据注释 以下是我迄今为止所做的工作: 我有一个基本项目,其中包含数据模型以及我们在整个解决方案中使用的一些全局常量。名称空间为GOLTracker.Base 在这里,我放置了我的.resx,并为其中一个类定义了一些基本的显示信息 下面是一段代码,它定义了一个类并利用了资源文件: public partial class Vehicle : TableEntity { [Required] [Binda

我很难在Azure/RIA/Silverlight应用程序中创建本地化数据注释

以下是我迄今为止所做的工作:

  • 我有一个基本项目,其中包含数据模型以及我们在整个解决方案中使用的一些全局常量。名称空间为
    GOLTracker.Base
  • 在这里,我放置了我的
    .resx
    ,并为其中一个类定义了一些基本的显示信息
下面是一段代码,它定义了一个类并利用了资源文件:

 public partial class Vehicle : TableEntity
 {
    [Required]
    [Bindable(true, BindingDirection.TwoWay)]
    [Display(Name = "VehicleNameLabel", Description = "VehicleNameDescription", ResourceType = typeof(DisplayResources))]
    public string Name { get; set; }
    (...)
 }
  • 第二个是我的
    GOLTracker.Role
    项目,它是Azure中的主要角色。它包含承载Silverlight应用程序的网页。这里没有资源。它还包含带有用于获取数据的查询的
    BoardDomainService
  • 最后,在
    GOLTracker.Board.
    中有两个Silverlight应用程序:
    Gui
    MapControlGui
    。两者都使用数据模型。在这两个应用程序中,我都添加了指向资源文件的链接(包括
    .resx
    .cs
此外,我还编辑了Silverlight项目文件以包含本地化信息:

<SupportedCultures>
  en-US;pl-PL
</SupportedCultures>
老实说,我不知道原因是什么;链接的
.resx
文件按其应有的方式是嵌入式资源。我不知道还缺少什么


请帮忙。

我找到了解决问题的办法。我不能说我喜欢它,因为它表明在生成代码时会发生一些丑陋的事情


找到的解决方案是将
添加到SL项目文件中链接的
.resx.
的定义中。

看起来无法从ARP.GOLTracker.Base.resources.DisplayResources.resources加载资源,这里有什么资源?只有
Vehicle
类中定义的用于测试的两种资源。因此
车辆名称标签
车辆名称说明
Message: System.ServiceModel.DomainServices.Client.DomainException: An error occurred
while loading data through the 'GetVehicles' query on DomainContext of type
'BoardDomainContext' and the error was not handled.  If this error is expected, then
you must handle the LoadedData event on the DomainDataSource and call
LoadedDataEventArgs.MarkErrorAsHandled() to avoid this exception.

Exception has been thrown by the target of an invocation. --->
System.Reflection.TargetInvocationException: Exception has been thrown by the target
of an invocation. ---> System.Resources.MissingManifestResourceException: Could not
find any resources appropriate for the specified culture or the neutral culture.  Make
sure "ARP.GOLTracker.Base.Resources.DisplayResources.resources" was correctly embedded
or linked into assembly "ARP.GOLTracker.Board.MapControlGui" at compile time, or that
all the satellite assemblies required are loadable and fully signed.