Search code examples
petapoco

How to explicitly include mapped tables with PetaPoco


I want to use PetaPoco on a table that has circa 600 tables, but I only want to map a handful of the tables.

Is there a way to explicitly state the tables I want mapping? The config in the t4 template (tables["tablename"].Ignore = true) doesn't really scale to this approach?


Solution

  • I ended up doing it like this:

    Tables tables = LoadTables();
    
     foreach(Table t in tables)
        {
            if(!t.Name.Contains("all_user_group"))
            {
                t.Ignore = true;   
            }
        }