i'm not sure how to provide a Room DAO, since it's an abstract class, any clues ?
This is a Room DAO provide example
Your RoomDatabase:
abstract class MyDatabase : RoomDatabase() {
abstract fun getDao(): MyDao
companion object {
fun buildDatabase(context: Context) =
Room.databaseBuilder(context, MyDatabase::class.java, "MyDatabase")
.fallbackToDestructiveMigration()
.build()
}
}
In your applicationContext module:
provide { MyDatabase.buildDatabase(androidApplication()).getDao() }
If the Database has more than one DAO:
provide { MyDatabase.buildDatabase(androidApplication()) }
provide { get<MyDatabase>().getDao1() }
provide { get<MyDatabase>().getDao2() }
ah i see, almost had it,
thank you !!
Most helpful comment
This is a Room DAO provide example
Your RoomDatabase:
In your applicationContext module:
If the Database has more than one DAO: