EF 6 Database First - Removing table prefix RRS feed

  • Question

  • I have an existing database with tables that have a prefix

    ex : tbl_mytable1

    I want to use entity framework 6, but When I generate models ( I am using an .edmx file to generate models from the database schema ) from my database, the prefix is included in the model name.

    ex: - public partial class tbl_mytable1 

    How do I configure entity framework to remove the prefix from the model name?

    Ex: It should appear as mytable1 instead of tbl_mytable1. 

    Monday, January 23, 2017 11:12 AM

All replies


    you could change the name via EDMX entities property. like this:


     using (var db = new EF20161102Entities())
                    var t1 = new mytable1() { Id = 2, Name = "Test2" };


    Best regards,

    Cole Wu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 24, 2017 8:04 AM