有关C#助手类的建议和建议 [英] Recommendation and suggestions for C# Helper Classes

查看:88
本文介绍了有关C#助手类的建议和建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我发现 SqlHelper类 使开发变得容易并且具有成本效益.我正在尝试构建一个新项目,其中将包含大多数Helpers类,以使开发人员的工作变得轻松.我需要您对这个项目的建议和建议,您可以使用或想要使用它.

它可能不被认为是问题,但很重要.


问候,
Aman

Hi Everyone,

I found that SqlHelper class made development easy as well as cost effective. I am trying to build new project which will contain most of Helpers classes to make a developer''s life easy. I want your recommendation and suggestions for this project, which you may use or want to use.

It might not be consider as question, but important.


Regards,
Aman

推荐答案

您正在谈论的是框架",工具",实用程序",...
我做了一些自己的事,尽管我并不声称自己是专家,但我的建议如下:

-如果可能的话,避免引用需要本地副本的其他程序集,如果只有本地副本,则可以使用它,但是如果您到处开始引用程序集,则将引起噩梦(dll地狱等...)

-尝试将功能分组在一起,例如.数据库访问,XML处理,配置,日志记录等...

-名字叫什么?一切!确保您有一个不错的命名空间约定.请注意,您迟早可能需要包括一个第三方产品,该产品也具有名称为"XYZ"的程序集.我经常使用类似CompanyName.Framework.Functionalitygroup
的名称
-请注意,您可以创建包含多个项目的框架解决方案,从而有效地创建多个程序集,如果需要,可以分别引用.

-将程序集添加到GAC(暗示强命名),否则您最终将在各处复制文件,尤其是如果您在团队中工作,您将流下眼泪.

-如果您使用的是Microsoft的Enterprise程序集,请保留100%的Microsoft,否则请不要使用它(例如,您需要使用Oracle).

-这些程序集可能经常使用,一遍又一遍地测试它们,并确保进行性能和负载测试.

希望这会有所帮助.

(PS:反对1票)
You''re talking about a "Framework", "Tools", "Utilities", ...
I''ve made a few myself, although I don''t claim to be an expert, here are my recommendations:

- If possible avoid references of other assemblies that need local copy, if you just have one, you could possibly live with it, but if you start referencing assemblies all over the place it will cause a nightmare (dll hell etc...)

- Try to group functionality together eg. Database access, XML handling, Configuration, Logging, etc...

- What''s in a name? Everything! Make sure you have a nice namespacing convention. Note that sooner or later you might need to include a third-party product that also has an assembly with name "XYZ". I often use something like CompanyName.Framework.Functionalitygroup

- Note that you can create a framework solution with multiple projects, effectively creating multiple assemblies which you could reference seperately if you want.

- Add the assemblies to the GAC (implies strong naming), else you just end up copying files all over the place and especially if you''re working in a team, you''ll end up in tears.

- If you''re using the Enterprise assemblies from Microsoft, stay 100% Microsoft, if not (you need to use Oracle for example) don''t use it.

- These assemblies are probably used very often, test them over and over and over again and make sure you do performance and load tests.

Hope this helps.

(PS: countered the 1 vote)


这篇关于有关C#助手类的建议和建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆