开发者

ASP.NET MVC : Correct location for custom classes, attributes, etc

开发者 https://www.devze.com 2023-03-08 15:50 出处:网络
I\'m currently doing a custom attribute, and did so开发者_如何学Gome custom classes for one of my ASP.NET MVC project.

I'm currently doing a custom attribute, and did so开发者_如何学Gome custom classes for one of my ASP.NET MVC project.

I was wondering, is there a dedicated location to put them? I mean, some correct path naming or something.

Like controllers goes in Controllers\, models in Models\, etc...

Any suggestion is welcome!

Thanks!


If those attributes represent custom action filters I would put them into the Filters sibfolder. If they represent validator data annotations, into the Validators folder, ... So based on their function I would find a name.


The way I usually do is add a separate library project and put them there, under descriptive folders in there, separating "MVC" from "the rest". Depending on the size of the project of course, smaller projects I would do as the previous answers and just create new folders with descriptive names.

0

精彩评论

暂无评论...
验证码 换一张
取 消