Search code examples
petapoco

How to make PetaPoco stop changing table names?


I'm using PetaPoco T4 Template (http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx), It always converting table names, for example it converts a table named "Media" to "Medium". Have you any idea how can I make it to stop doing that?

Thanks


Solution

  • In your .Database.tt file you can tweak the class names to your liking for each table:

    tables["Media"].ClassName = "Media";
    

    I don't know of a way to turn this off everywhere. I believe it is a remnant from the SubSonic inflector. In the SchemaReader classes you will see a call like this:

    tbl.ClassName=Inflector.MakeSingular(tbl.CleanName);
    

    You could try changing that to

    tbl.ClassName=tbl.CleanName;