项目命名约定

发布于 2024-10-10 07:30:52 字数 363 浏览 2 评论 0原文

我正在争论在我们团队的 .sln 中命名项目的最佳实践是什么。我们正在 Visual Studio 中工作并讨论项目的命名和类的放置应该是什么。以下是两个参数:

  1. 应该有一个“Common”项目,其中包含两个文件夹:“Contracts”和“Model”。 “Contracts”文件夹中将包含接口,当然“Model”文件夹中将包含数据模型。这样做的优点是只发布一个 .dll,其中包含模型和合约。
  2. 应该有一个“模型”项目和一个“合同”项目。 “模型”项目应包含数据模型,“合同”项目将包含接口。这里的优点在于命名,您知道每个 .dll 中的内容。

如此简化的问题实际上是,对于接口和模型来说,是有两个单独的项目更好,还是有一个项目更好?

I am in a debate about what a best practice would be for naming projects within a .sln on our team. We are working in Visual Studio and debating about what the project naming and placement of classes should be. Here are the two arguments:

  1. There should be a "Common" project which will contain two folders: "Contracts" and "Model". Within "Contracts" folder will be the interfaces and of course within "Model" folder will be the data model. The advantage to this is that there will only be one .dll published which will have both the model and contracts within it.
  2. There should be a "Model" project and a "Contracts" project. "Model" project should contain the data model and the "Contracts" project will contain the interfaces. The advantage here is in the naming, you know what will be in each .dll.

So simplified the question really is, is it better to have two separate projects or one project for the interfaces and model?

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

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

发布评论

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

评论(2

任谁 2024-10-17 07:30:52

我会将它们分成单独的项目。您的解决方案可能会包含更多 DLL,并且您希望能够从其中任何一个访问接口。如果将它们转储到与模型相同的 DLL 中,则将来出现循环依赖的风险会更高。

I'd separate them into separate projects. Your solution will likely include more DLLs, and you'll want to be able to access the interfaces from any of them. If you dump them into the same DLL with your Models, you run a higher risk of a circular dependency down the road.

屋檐 2024-10-17 07:30:52

这取决于,我会将项目保留在可重复使用性的基础上。意味着每个项目都以特定的内容为导向。

另请注意,即使在保持分离后,您也可以将它们合并到单个dll中。这样你命名的目的也就达到了。

It depends, I would keep projects on RE USABILITY basis. Means each project specific to content oriented.

Also note even after keeping separate you can merge them in single dll. So you objective of naming will also be achieved.

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