C# 存储库接口命名约定
如果我声明了一个带有依赖注入(存储库接口)的控制器,那么存储库的一般命名约定是什么 行业是否普遍倾向于:C# 存储库接口命名约定,c#,naming-conventions,C#,Naming Conventions,如果我声明了一个带有依赖注入(存储库接口)的控制器,那么存储库的一般命名约定是什么 行业是否普遍倾向于: productrepository _productRepository _ProductRepository? 开始编程,努力学习 public class ProductsController : Controller { public ElectronicsContext _context; public IProductRepository<Produc
productrepository
_productRepository
_ProductRepository?
开始编程,努力学习
public class ProductsController : Controller
{
public ElectronicsContext _context;
public IProductRepository<Product> _ProductRepository;
公共类产品控制器:控制器
{
公共电子语境;
公共IPProductRepository\u ProductRepository;
使用。它建议产品存储库
:
public IProductRepository<Product> ProductRepository;
公共IPProductRepository ProductRepository;
这是我从Resharper那里看到的,它提出了这个问题,所有其他资源都在使用_smallercase等,_ProductRepository在C中#有些人使用的约定是下划线用于私人成员。好吧,看来行业标准是Resharper,将使用它,谢谢-@TVLamp,因为您的产品存储库
是公共的,您不需要使用下划线。正如Krzysztof Błażełek所说,下划线通常用于私人成员。好的,将其更改为私人,Resharper只是将其小写,不使用下划线,感谢许多好的问题根据专家经验产生了一定程度的意见,但对这一问题的答案是正确的stion几乎完全基于观点,而不是事实、参考资料或特定的专业知识。请避免提出基于主要观点的问题,因为这些问题与堆栈溢出无关。请阅读以了解主题是什么类型的问题。NET行业正在摆脱过时的存储库模式