如果通常在存储库的结构中执行任何操作来反映已部署的单元,该怎么办?

发布于 2024-07-06 03:54:03 字数 603 浏览 4 评论 0原文

这是问题的后续:

应该解决方案中的文件夹与命名空间匹配吗?

对于这个问题的共识是合格的“是”:也就是说,文件夹 == 命名空间,通常,但不是盲目地(java 要求的方式)。

事实上,这就是我建立项目的方式。

但设置源代码管理让我对当前的文件夹结构犹豫不决。 与 .NET Framework 一样,我的项目中的命名空间并不总是与部署的单元一一匹配。 换句话说

lib             -> lib.dll
lib.data        -> lib.dll
lib.ecom        -> lib.ecom.dll
lib.ecom.paypal -> lib.ecom.paypal.dll

,子名称空间可能会或可能不会随父名称空间一起提供。

那么部署在一起的命名空间是否以某种方式分组?

顺便说一句,我不使用 VS 或 NAnt — 只是使用老式的构建批次。

This is a follow-up to the question:

Should the folders in a solution match the namespace?

The consensus on that question was a qualified "yes": that is, folders == namespaces, generally, but not slavishly (the way java requires).

Indeed, that's how I set up projects.

But setting up source control has made me hesitate about my current folder structure. As with the .NET Framework, the namespaces in my project do not always match the deployed units one-to-one. Say you have

lib             -> lib.dll
lib.data        -> lib.dll
lib.ecom        -> lib.ecom.dll
lib.ecom.paypal -> lib.ecom.paypal.dll

In other words, child namespaces may or may not ship with the parent.

So are the namespaces that deploy together grouped in any way?

By the way, I don't use VS or NAnt — just good old fashioned build batches.

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

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

发布评论

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

评论(1

无戏配角 2024-07-13 03:54:03

我通常不会真正考虑这一点,只是做“感觉正确的事情”,但通常我最终会使用非常适合以下策略的名称。

我将使用树中最高的通用命名空间作为 .dll 名称,就像您所做的那样;

对于 lib 和 lib.data,这是 lib,因此 dll 称为 lib。 对于 lib.ecom 和 lib.ecom.paypal,这是 lib.ecom,因此该 dll 称为 ecom。

在某些情况下,您需要多考虑一些事情,例如我们有以下命名空间(警告,即将出现的简单示例),我们希望将它们分组在两个 dll 中,

myapp.view
myapp.presentation

myapp.model
myapp.dataaccess

我们不能使用 myapp,因为那样我们将有两个 myapp 程序集。 在本例中,我使用最合适的命名空间的名称。 如果这些命名空间最重要,第一个可能称为 myapp.presentation,第二个可能称为 myapp.model。

I usually don't really think about this and just do "what feels right" but usually I end up using names that fit the following strategy fairly well.

I'll use the highest common namespace in the tree for the .dll name just like you seem to be doing;

with lib and lib.data this is lib so the dll is called lib. With lib.ecom and lib.ecom.paypal this is lib.ecom so the dll is called ecom.

In some cases you need to think about things a bit more for example we have the following namespaces (warning, simplistic example coming up) and we want to group them in two dll's

myapp.view
myapp.presentation

myapp.model
myapp.dataaccess

we can't use myapp because then we would have two myapp assemblies. In this case I use the name of the namespace that is most appropriate. The first might be called myapp.presentation and the second myapp.model if those namespaces are the most important.

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