问题描述
我已将.NET项目分为三个不同的层:立面层,业务层和数据访问层.
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.What.Business.Accounts
- MyCompany.What.Facade.Accounts
这篇关于图层的文件命名约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!