There really isn't any "rule book" for naming conventions. You find one that works for you.
The most common adoption with .Net is to follow the Microsoft .Net naming conventions, and with Web Services, just treat them as an extension of your assembly, not as a special case.
You could also have the GetMortgages() service method take a 'document' instead of parameters and design the optional filter criteria in the document. That way you have only one method that handles all 'overloads'.
I think you're doing fine. Describe them based on what it is they're doing. GetAllMortgages(), GetMortgagesInPriceRange(), etc.
Take into consideration any domain-specific terminology. For instance, if the mortgage-industry term for a price range of a mortgage had been "Demographic", then GetMortgagesForDemographic would be the better name, even if you know that the only "demographic" features are the price range.
发布评论
评论(5)
实际上没有任何命名约定的“规则手册”。 您会找到一个适合您的。
.Net 最常见的采用是遵循 Microsoft .Net 命名约定,而对于 Web 服务,只需将它们视为程序集的扩展,而不是特殊情况。
http://msdn.microsoft.com/en-us/library/ms229045。 aspx
所以,GetMortgages()、GetMortgagesInPriceRange(startPrice,endPrice) 等...就可以了。
说到“保存”,很多人会使用“SubmitNoun”。
There really isn't any "rule book" for naming conventions. You find one that works for you.
The most common adoption with .Net is to follow the Microsoft .Net naming conventions, and with Web Services, just treat them as an extension of your assembly, not as a special case.
http://msdn.microsoft.com/en-us/library/ms229045.aspx
So, GetMortgages(), GetMortgagesInPriceRange(startPrice,endPrice), etc... is fine.
As far as "saving", a lot of people will use the "SubmitNoun".
另外,您应该避免重载 Web 服务方法。 使用不同的方法名称。
Also, you should probably avoid overloading web service methods. Use distinct method names.
您还可以让 GetMortgages() 服务方法采用“文档”而不是参数,并在文档中设计可选的过滤条件。 这样你就只有一种方法来处理所有“重载”。
You could also have the GetMortgages() service method take a 'document' instead of parameters and design the optional filter criteria in the document. That way you have only one method that handles all 'overloads'.
我认为你做得很好。 根据他们正在做的事情来描述他们。 GetAllMortgages()、GetMortgagesInPriceRange() 等。
考虑任何特定于领域的术语。 例如,如果抵押贷款价格范围的抵押贷款行业术语是“人口统计”,那么 GetMortgagesForDemographic 将是更好的名称,即使您知道唯一的“人口统计”特征是价格范围。
I think you're doing fine. Describe them based on what it is they're doing. GetAllMortgages(), GetMortgagesInPriceRange(), etc.
Take into consideration any domain-specific terminology. For instance, if the mortgage-industry term for a price range of a mortgage had been "Demographic", then GetMortgagesForDemographic would be the better name, even if you know that the only "demographic" features are the price range.
如果您有类似存储库的服务(正如我通过您的示例假设的那样)约定,您可以使用存储库模式
You could go with repository-pattern if you have repository-like service (as I assume by your examples you have) convention