0
我很難在Azure/RIA/Silverlight應用程序中創建本地化數據註釋。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>
一切正確編譯。然而,當我嘗試在任何Silverlight應用程序,這使得使用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.
說實話,我不知道是什麼原因;鏈接的.resx
文件是嵌入的資源,因爲它們應該是。我不知道還有什麼遺漏。
請幫忙。
它看起來像無法從ARP.GOLTracker.Base.Resources.DisplayResources.resources加載資源,你在這裏有什麼資源? – Jethro
只是在'Vehicle'類中定義的兩個用於測試目的。所以'VehicleNameLabel'和'VehicleNameDescription'。 – Shaamaan