Code Generation Template - Active Columns

Thread is closed for posting
2 posts, 0 answers
  1. Sambathraj
    Sambathraj avatar
    16 posts
    Member since:
    Jan 2011

    Posted 24 Jan 2014 Link to this post


    Within my database scheme all of the tables are having active columns. I want to modify the code the generation template such that always the Get calls returns me active rows.

    I have to do it today like <Entity>.Where(n=>n.Active == true). I would like to avoid repeating such code in the middle tier / UI. Please let me know if there is a way to do this.


  2. Jan Blessenohl
    Jan Blessenohl avatar
    707 posts

    Posted 27 Jan 2014 Link to this post

    Hi Sambath,

    My proposal is that you add a partial class to your generated context class and add Active* entry points:

    public partial class MyContext


        public IQueryable<Entity> ActiveEntities { get { return this.GetAll<Entity>().Where(x=>x.Active == true);}}


    In your code you can now use context.ActiveEntities.Where().OrderBy()...


    Jan Blessenohl
    OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Back to Top