1. <tfoot id='2BgHG'></tfoot>
        <i id='2BgHG'><tr id='2BgHG'><dt id='2BgHG'><q id='2BgHG'><span id='2BgHG'><b id='2BgHG'><form id='2BgHG'><ins id='2BgHG'></ins><ul id='2BgHG'></ul><sub id='2BgHG'></sub></form><legend id='2BgHG'></legend><bdo id='2BgHG'><pre id='2BgHG'><center id='2BgHG'></center></pre></bdo></b><th id='2BgHG'></th></span></q></dt></tr></i><div id='2BgHG'><tfoot id='2BgHG'></tfoot><dl id='2BgHG'><fieldset id='2BgHG'></fieldset></dl></div>

        <legend id='2BgHG'><style id='2BgHG'><dir id='2BgHG'><q id='2BgHG'></q></dir></style></legend>

        <small id='2BgHG'></small><noframes id='2BgHG'>

        • <bdo id='2BgHG'></bdo><ul id='2BgHG'></ul>

        我可以在附属程序集中合并本地资源吗?

        时间:2023-08-26
      2. <i id='z10gj'><tr id='z10gj'><dt id='z10gj'><q id='z10gj'><span id='z10gj'><b id='z10gj'><form id='z10gj'><ins id='z10gj'></ins><ul id='z10gj'></ul><sub id='z10gj'></sub></form><legend id='z10gj'></legend><bdo id='z10gj'><pre id='z10gj'><center id='z10gj'></center></pre></bdo></b><th id='z10gj'></th></span></q></dt></tr></i><div id='z10gj'><tfoot id='z10gj'></tfoot><dl id='z10gj'><fieldset id='z10gj'></fieldset></dl></div>

        • <bdo id='z10gj'></bdo><ul id='z10gj'></ul>

          <small id='z10gj'></small><noframes id='z10gj'>

            <tbody id='z10gj'></tbody>
          <legend id='z10gj'><style id='z10gj'><dir id='z10gj'><q id='z10gj'></q></dir></style></legend>
            • <tfoot id='z10gj'></tfoot>

                  本文介绍了我可以在附属程序集中合并本地资源吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有很多本地资源文件

                  • /Controls/App_LocalResources/SomeControl.ascx.resx,
                  • /Pages/App_LocalResources/SomePage.aspx.resx等

                  我想添加另一种语言,但我不想浏览所有文件夹并添加 SomeControl.ascx.de.resx 文件,例如,然后必须重新编译整个想法.

                  I want to add another language and I do not want to go through all folders and add SomeControl.ascx.de.resx files for example and then have to recompile the whole think.

                  我想使用附属程序集并将所有文件嵌入到 MyWebPage.de.dll 之类的文件中

                  I would like to use satellite assemblies and embed all the files into something like MyWebPage.de.dll

                  这在VS2003版本的全局资源中是可以的,但是我不确定在VS2008版本的本地资源中是否可以这样做?

                  This was possible in VS2003 version for global resources, but I'm not sure can I do it in VS2008 version for local resources?

                  我正在使用以下语法访问资源:

                  I am accessing the resource with the syntax:

                  <asp:label id="lblSomething" runat="server" meta:resourcekey="labelFirstName"/>
                  

                  推荐答案

                  您的问题不是很清楚,您是在寻找 VS2008 的功能还是 ASP.NET 框架的功能.所以我会用代码解决方案.

                  Your question isn't really too clear on whether you are looking for a feature of VS2008 or a feature of the ASP.NET framework. So I'll go with the code solution.

                  您使用的隐式绑定语法使用 ASP.NET 的默认 LocalResourceProvider,它采用资源所在的页面路径来计算要加载的资源.如果您的资源存储在其他地方,并且您仍想在前面的代码中使用隐式绑定系统税,您将需要使用您自己的 Provider.听起来很复杂,但其实很简单.

                  The implicit binding syntax you're using uses ASP.NET's default LocalResourceProvider which takes in the path of page under which the resources live to work out which resources to load. If your resources are stored elsewhere and you still want to use the implicit binding systax in your code in front you'll need to use your own Provider. Sounds complicated but it's fairly straightforward.

                  要做到这一点,您需要首先将 ResourceProviderFactory 子类化

                  To do this you'll need to first subclass ResourceProviderFactory

                  并覆盖两者

                  IResourceProvider CreateGlobalResourceProvider(string classKey)
                  IResourceProvider CreateLocalResourceProvider(string virtualPath)
                  

                  ...然后实现您自己的 IResourceProvider,使用 ResourceManager 从附属程序集中获取资源

                  ...then implement your own IResourceProvider that gets your resources from your satellite assemblies using a ResourceManager

                  public interface IResourceProvider
                  {
                       object GetObject(string resourceKey, CultureInfo culture);
                       IResourceReader ResourceReader { get; }
                  }
                  

                  然后您需要将配置添加到您的 web.config 文件,让 ASP.NET 知道使用您的 SatelliteResourceProviderFactory 并将您的资源移动到您的外部程序集,但这应该是您的好去处.

                  You then need to add configuration to your web.config file to let ASP.NET know to use your SatelliteResourceProviderFactory and move your resources in to your external assemby, but that should be you good to go.

                  可以在此处找到大量文档...在构建数据库资源提供程序"部分下...

                  Plenty of documentation can be found here...under the "Building a Database Resource Provider" section...

                  http://msdn.microsoft.com/en-us/库/aa905797.aspx#exaspnet20rpm_topic4

                  这篇关于我可以在附属程序集中合并本地资源吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:WPF 运行时区域设置更改,重新评估 ValueConverter 下一篇:脚本在 dotnet WebBrowser 控件中运行速度较慢

                  相关文章

                  最新文章

                1. <tfoot id='vFL34'></tfoot>

                  <small id='vFL34'></small><noframes id='vFL34'>

                        <bdo id='vFL34'></bdo><ul id='vFL34'></ul>
                    1. <i id='vFL34'><tr id='vFL34'><dt id='vFL34'><q id='vFL34'><span id='vFL34'><b id='vFL34'><form id='vFL34'><ins id='vFL34'></ins><ul id='vFL34'></ul><sub id='vFL34'></sub></form><legend id='vFL34'></legend><bdo id='vFL34'><pre id='vFL34'><center id='vFL34'></center></pre></bdo></b><th id='vFL34'></th></span></q></dt></tr></i><div id='vFL34'><tfoot id='vFL34'></tfoot><dl id='vFL34'><fieldset id='vFL34'></fieldset></dl></div>

                      <legend id='vFL34'><style id='vFL34'><dir id='vFL34'><q id='vFL34'></q></dir></style></legend>