# Use Hangfire with Entity Framework Core

**URL:** <https://discuss.hangfire.io/t/use-hangfire-with-entity-framework-core/9084>\
**Category:** feature\
**Created:** [April 7, 2022, 8:21am UTC](https://discuss.hangfire.io/t/use-hangfire-with-entity-framework-core/9084 "2022-04-07T08:21:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yazana](https://avatars.discourse-cdn.com/v4/letter/y/85e7bf/32.png) [@yazana](https://discuss.hangfire.io/u/yazana)\
**Post date:** [April 7, 2022, 8:21am UTC](https://discuss.hangfire.io/t/use-hangfire-with-entity-framework-core/9084/1 "2022-04-07T08:21:51Z")

</div>

Hello,

I need to create a DBContext for Hangfire and use its tables as DBSet to get some reporting.  
Any idea please how to reach that ?

Regards.

---

<div class="post-metadata">

**Author:** ![aschenta](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/aschenta/32/2837_2.png) [@aschenta](https://discuss.hangfire.io/u/aschenta)\
**Post date:** [April 9, 2022, 3:31pm UTC](https://discuss.hangfire.io/t/use-hangfire-with-entity-framework-core/9084/2 "2022-04-09T15:31:22Z")

</div>

> **[Entity Framework Core with Existing Database](https://www.entityframeworktutorial.net/efcore/create-model-for-existing-database-in-ef-core.aspx)**
>
> Learn how to use Entity Framework Core with existing database (database-first approach).

This is referred to as “database first.” You create the db context from an existing database. Not sure what you’re looking to do. By default, completed jobs aren’t stored in the database for very long.

---

<div class="post-metadata">

**Author:** ![yazana](https://avatars.discourse-cdn.com/v4/letter/y/85e7bf/32.png) [@yazana](https://discuss.hangfire.io/u/yazana)\
**Post date:** [April 11, 2022, 7:04am UTC](https://discuss.hangfire.io/t/use-hangfire-with-entity-framework-core/9084/3 "2022-04-11T07:04:18Z")

</div>

Thank you aschenta.

Regards.
