图层的文件命名约定 [英] File naming convention for layers

查看:17
本文介绍了图层的文件命名约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的 .NET 项目分成三个不同的层 Facade Layer、Business Layer 和 Data Access Layer.

I have split my .NET project into three different layers Facade Layer, Business Layer and Data Access Layer.

我正在为这些层的文件名寻找正确的命名约定.例如,如果我的项目中有与帐户相关的功能,我目前在外观层中有AccountsFAC.cs"和类名 AccountsFAC,在业务层中有 AccountsBL.cs 和类名 AccountsBL,在 DAL 层中有 AccountsDAL.cs 和 AccountsDAL 类名.

I am looking for the correct naming convention for the file names for these layers. For example if I have accounts related function in my project, I am currently having 'AccountsFAC.cs' and class name AccountsFAC in facade layer, AccountsBL.cs and class name AccountsBL in business layer, AccountsDAL.cs and AccountsDAL class name in DAL Layer.

我想知道这是否是在不同层中命名文件的正确方法.

I want to know whether this is the correct way of namign the files in different layers.

建议#1

Robert Koritnik 在下面给出的建议之一是使用描述性名称,例如AccountStore"和AccountService"

One of the suggestions given by Robert Koritnik below is to use descriptive names like 'AccountStore' and 'AccountService'

推荐答案

我可能不会在实际的类名称中包含图层缩写.我会将类划分为适当的库和命名空间,以便命名空间指示层,而不是类名.

I probably wouldn't include the layer abbreviations in the actual class names. I would divide the classes into appropriate libraries and namespaces, so that the namespace indicates the layer, not the class name.

这些都是糟糕的例子,你应该选择更有意义的命名空间,但更像是这样的:

These are terrible examples, you should choose more meaningful namespaces, but something more like this:

  • MyCompany.Whatever.Data.Accounts
  • MyCompany.Whatever.Business.Accounts
  • MyCompany.Whatever.Facade.Accounts

这篇关于图层的文件命名约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆