嵌入式视图和本地化

发布于 2024-10-10 10:16:42 字数 299 浏览 0 评论 0原文

我在类库中获得了一些通用剃刀(视图引擎)视图,我想通过 VirtualPathProvider 加载它们。

除非我将 .sv.en 添加到视图名称(例如 MyView.en.cshtml),否则一切都会正常工作。通过这样做,Visual Studio 似乎将视图编译到资源 DLL 中。

我可以阻止吗?

必须在 VirtualPathProvider 中加载资源 DLL 似乎很麻烦。 一个线程可能想要访问瑞典语视图,而另一个线程可能想要访问英语视图。

I got some generic razor (view engine) views in a class library that I want to load through a VirtualPathProvider.

Everything works great unless I add .sv or .en to the view names (for example MyView.en.cshtml). By doing so it seems like Visual Studio compiles the views into resource DLLs.

Can I prevent that?

Having to load resource DLL's in my VirtualPathProvider seems like a hassle.
One thread might want to access Swedish views while the other want's English views.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自演自醉 2024-10-17 10:16:42

我将视图重命名为 XXXXX._langCode.cshtml(如 details._sv.cshtml 中所示)。然后,在返回它们之前,我将它们重命名回我的 VirtualPathProvider 中。

有效,但并不能真正解决问题。

I renamed the views to XXXXX._langCode.cshtml (as in details._sv.cshtml). I then renamed them back in my VirtualPathProvider before returning them.

Works, but not really a solution to the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文