Resource Application Block 3.1

Topics: Development Team Discussion, User Discussion
Mar 18, 2008 at 2:56 PM
I'm trying to adopt the Resource Application Block 3.1, with especially the use of "Data Resource Manager".
After following the wiki "Using a Database", the writing into the database is going well, but the reading part gives unexpected errors.
The most common error i got is "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: <MyResourceName>"
This is while trying "HttpContext.GetGlobalResourceObject", "EntLibContrib.Resource.ResourceManager.GetString", "EntLibContrib.Resource.ResourceManager.GetObject" etc.

Could anywone point me i in the right direction? The database is created by the script included and on sql 2005 express edition for test purposes.

Thanks in advance!
Coordinator
Mar 24, 2008 at 9:11 PM


ramonstouten wrote:
I'm trying to adopt the Resource Application Block 3.1, with especially the use of "Data Resource Manager".
After following the wiki "Using a Database", the writing into the database is going well, but the reading part gives unexpected errors.
The most common error i got is "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: <MyResourceName>"
This is while trying "HttpContext.GetGlobalResourceObject", "EntLibContrib.Resource.ResourceManager.GetString", "EntLibContrib.Resource.ResourceManager.GetObject" etc.

Could anywone point me i in the right direction? The database is created by the script included and on sql 2005 express edition for test purposes.

Thanks in advance!


The error message is that the resource name has not been found in the resource store (the database in this case) I will need a little more information to diagnose the problem. One observation is that the parameter name looks a bit odd with the angle brackets. Could you give me the syntax you are using and your config file perhaps? The other thing to check is the basename that you are using which needs to be specified in the ASPX code.

Cheers... ewdev
Apr 1, 2008 at 4:12 AM
I'm Trying implement`s Resource Application Block 3.1 with "Data Resource Manager" for use a database, but i need include and new Resource manager for each page on the web application, because the application blocks uses the name of de page in the creation of the local resorce provider, is necesary implement's an Resource Manager for each page???

thanks

Manuel Enrique Benavides
Bogota, Colombia
Coordinator
Apr 11, 2008 at 3:40 PM


Manuelenrique wrote:
I'm Trying implement`s Resource Application Block 3.1 with "Data Resource Manager" for use a database, but i need include and new Resource manager for each page on the web application, because the application blocks uses the name of de page in the creation of the local resorce provider, is necesary implement's an Resource Manager for each page???


Hi Manuel

Unfortunately that is the way that the Microsoft ASP.NET resource provider model works for Local Resources. If you are using the Data Resource provider you would typically create a separate basename for each web page and then you would configure a separate resource manager in the configuration file for each page where the name of the resource manager matches the name of the web page. This way you can take advantage of the Generate Local Resources tool in Visual Studio however; there are other options:

1. You can use a single basename and simply point each configured resource manager to the same basename. The advantage with this is that when you share resources between pages you only need one entry in the database. The disadvantage with this is that every resource will be loaded for every page including those resources not used on the page.

2. You don't need to use Local Resources. You can use Global Resources which work in a similar fashion to assembly embedded resources. The advantage is that you only need to configure one, or a few, resource managers. The big disadvantage is that you have to do all the resource assignment to web controls manually in your code.

Cheers... Steve