开发者

Where do utility methods fit in ASP.NET MVC setup?

开发者 https://www.devze.com 2023-04-11 01:41 出处:网络
Where do utility methods go in MVC setup? They are not Models, Views or Controller. They don\'t belong in those folders. So do is the only right thing to do is to keep utility methods ou开发者_运维技巧

Where do utility methods go in MVC setup? They are not Models, Views or Controller. They don't belong in those folders. So do is the only right thing to do is to keep utility methods ou开发者_运维技巧tside your ASP.NET MVC project and put them into a project of their own?


It really depends on how big your project is. If it's just a small project with a few utility methods, then what I normally do is put them in a folder called "Infrastructure" inside the MVC project.

The initial setup you get for an MVC project is only really a guide (with some exceptions), and you're free to add folders and put code in them if you want to.

If there's going to be a lot of supporting code, then a separate project might be cleaner and easier in the long run.

0

精彩评论

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