hazemfadl
asked on
What is better in c#?
Put connection string and some common function I use it in public class
Like {GetLastID , FillGrid,&}
Or put every function in its class
Note: I used N-tier (layer) at my work.
Thanks for help
Like {GetLastID , FillGrid,&}
Or put every function in its class
Note: I used N-tier (layer) at my work.
Thanks for help
Okay I believe in having Utility classes. An approach you can take is creating your own framework project so it can be consumed within any of your tiers. For example
Company.Framework
Company.Application.Busine ss --> uses Company.Framework
Company.Application.Data --> uses Company.Framework
Company.Application.Presen tation --> use Company.Framework
Within your framework project you can different Utility classes that assist with different things for example serialization, data access, string manipulation, etc. Now it absolutely doesn't make sense for a class to have one method, that's not to say that a class cannot have one method if that's the only one that's relevant.
Group related functions in the same class.
Company.Framework
Company.Application.Busine
Company.Application.Data --> uses Company.Framework
Company.Application.Presen
Within your framework project you can different Utility classes that assist with different things for example serialization, data access, string manipulation, etc. Now it absolutely doesn't make sense for a class to have one method, that's not to say that a class cannot have one method if that's the only one that's relevant.
Group related functions in the same class.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DRY : http://en.wikipedia.org/wiki/Don't_repeat_yourself