LocalResources and DB

Last post 11-09-2007 5:57 AM by Gustavo Villa. 2 replies.

Sort Posts:

  • LocalResources and DB

    11-08-2007, 2:28 AM

     

    Hello all,

    I  have project to work with a web application to retrieve local and global resources from a DB. This project also replace the default tool of VS to create the local resources and when you use the Generate Local Resource tool adds all the resources of the page to the DB.

    You may know that this tool (Generate Local Resource) creates a group of resources for each control (for the label control, Text and Tooltip, for example) and I would like to add one property to be created in the DB when this tool is used. What I would like to get is that this tool to generate the ImageUrl resource for Image controls.

    Do you know How I can get this?

     
    Thank you!


     

  • Re: LocalResources and DB

    11-08-2007, 1:15 PM
    Answer
    • Loading...
    • jamlew
    • Joined on 09-21-2007, 3:43 PM
    • Bellevue, WA
    • Posts 28
    • AspNetTeam

    For runtime resource support, you need a class which descends from ResourceProviderFactory and appropriate IResourceProvider implementations for the local and global resources.  I recall finding some sample codes for using a database as a backend for your resources, but I didn't save the links.  Just use search keywords like 'sql resource provider asp.net' or something similar and it should be fairly easy to find.

    For the design time support (i.e. Generate Local Resource), you need a class that descends from DesignTimeResourceProviderFactory and implementations for the corresponding IResourceProvider (for previewing I think) and IDesignTimeResourceWriter.  I couldn't find any database samples for this when I was trying to figure it out, but here is a sample one using Access that you might be able to port.  I didn't have enough time to try that msyelf.

    ---------
    If this post has solved your problem, please select 'Mark as answer'

    Microsoft SDET
    Visual Web Developer Team
    Silverlight Tools for VS
  • Re: LocalResources and DB

    11-09-2007, 5:57 AM

    The proyect we use has a class that implements IDesignTimeResourceWriter that has the method AddResource(string name , object value) that implements System.Resources.IResourceWriter.AddResource, that save the data in a ListDictionary used, some steps later, to create the resources in the DB. This method is called by VS, which send the resource name (e.g. Label1.Text) and the value, and I am again at the beginning.

    There is another method  System.Web.UI.Design.IDesignTimeResourceWriter.CreateResourceKey, as far I have tested, it is not called anytime.

    Thank you, your indications has given me where to look for. 

     


Page 1 of 1 (3 items)
Microsoft Communities
Page view counter