MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Can I add new resource strings using DB resource model? (Closed) (Mono Support )

Viewed 6706 time(s), 3 post(s) 12/28/2011 5:00:13 PMby grant.stone007
grant-stone007

grant.stone007

12/28/2011 5:00:13 PM
I am using the DB resource model. Is it possible to add new resources? for example...

1. I added new record to table LocalizationSource
Source=MonoSoftware.MonoX.MonoX.Resources.PageResources
ResourceKey=myKey
2. I added realted record in LocalizationString with Data=Hello World.

I thought I could implement new resource in markup something like this...

<asp:Literal ID="Literal1" runat="server" Text="<%$ Code: PageResources.myKey %>"></asp:Literal>

but I get an error: BC30456: 'myKey' is not a member of 'MonoSoftware.MonoX.Resources.PageResources'.

I obviously do not understand how MonoX resource work. Please advise if there is way to implement my own resource strings.
This content has not been rated yet. 
647 Reputation 69 Total posts
khorvat

khorvat

12/29/2011 3:42:36 PM
Hi,

this strongly typed resource access can't be accomplished with the DB resource provider because all newly added resource keys are not compiled into the assembly. Strongly typed keys are only available to default MonoX keys as they were added with the Visual Studio with ResourceManager provider. When you use DB resource provider you need to access newly added keys with loosely typed strings via resource manager under the e.g. PageResources.

You should use the following code to access your key:
PageResources.ResourceManager.GetString("YourKey")



Regards  
Rated 5.00, 1 vote(s). 
15993 Reputation 2214 Total posts
grant-stone007

grant.stone007

12/30/2011 2:55:20 AM
Thank you. That works just fine as a solution for my custom strings.
This content has not been rated yet. 
647 Reputation 69 Total posts