Business Rules guidance

4 posts, 1 answers
  1. Gene
    Gene avatar
    64 posts
    Member since:
    Dec 2007

    Posted 31 Dec 2008 Link to this post

    I'm looking for some guidance on where business rules should be coded.  Can they be put into the partial class file that contains the class properties?  Or should they go someplace else?  What is the best practice? 

    thanks in advanc
    Gene
  2. Answer
    Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 02 Jan 2009 Link to this post

    Hello Gene,

    yes, the business code should be in a partial class file like the properties are. You can put that into the properties part or you might want to consider using another partial class file just for organizational purposes.

    Another (but not preferred by me) way would be to use extension methods, which better separates the public and the private aspects of a class.

    Greetings,
    Thomas
  3. DevCraft banner
  4. Gene
    Gene avatar
    64 posts
    Member since:
    Dec 2007

    Posted 05 Jan 2009 Link to this post

    Thomas,

    Thanks for the reply.  When do I need to worry about my classes being overwritten during automated generation?

    Thanks again.
    Gene.
  5. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 05 Jan 2009 Link to this post

    Hi Gene Kula,

    whenever you do the reverse engineering step (manually from VS), there is a dialog asking you which class files (partial) should be generated. Only those files will be generated (again, only the XXX.Telerik.OpenAccess.cs partial class files, not your XXX.cs file) when selected.
    We think of the 'automated generation' not as a cyclic step (although we support that), but as a one time 'get-me-a-matching-model-for-the-db-i-have' step. When you need to alter the database afterwards, it is very likely you need to regenerate only one partial class file.

    Greetings,
    Thomas
Back to Top