# Access hangfire tables in code

**URL:** <https://discuss.hangfire.io/t/access-hangfire-tables-in-code/6381>\
**Category:** question\
**Created:** [July 17, 2019, 3:16pm UTC](https://discuss.hangfire.io/t/access-hangfire-tables-in-code/6381 "2019-07-17T15:16:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Irfan\_Yusanif](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/irfan_yusanif/32/1689_2.png) [@Irfan\_Yusanif](https://discuss.hangfire.io/u/Irfan_Yusanif)\
**Post date:** [July 17, 2019, 3:16pm UTC](https://discuss.hangfire.io/t/access-hangfire-tables-in-code/6381/1 "2019-07-17T15:16:45Z")

</div>

My web app is in [asp.net](http://asp.net) MVC with mysql database.

Here is the hangfire configuration:

```auto
public void ConfigureServices(IServiceCollection services)
{
    services.AddHangfire(configuration => {
        configuration.UseStorage(
            new MySqlStorage(
                "server=127.0.0.1;uid=root;pwd=root;database={0};Allow User Variables=True",
                new MySqlStorageOptions
                {
                    TablesPrefix = "Hangfire"
                }
            )
        );
    };
}

```

> I’m getting excepton table `hangfireSet` not found.

In database table is created as `hangfireset`

I can solve this issue by changing table names to lower case in OnModelCreating as shown below:

```auto
protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);

        modelBuilder.Entity<TableName>().ToTable("tablename");
    }

```

How can I access hangfire model classes in OnModelCreating so that I can change table names to lower case.

---

<div class="post-metadata">

**Author:** ![Irfan\_Yusanif](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/irfan_yusanif/32/1689_2.png) [@Irfan\_Yusanif](https://discuss.hangfire.io/u/Irfan_Yusanif)\
**Post date:** [July 18, 2019, 1:19pm UTC](https://discuss.hangfire.io/t/access-hangfire-tables-in-code/6381/2 "2019-07-18T13:19:52Z")

</div>

OR How can I Make table names in lower case
