Skip to content

Instantly share code, notes, and snippets.

@manijshrestha
Created June 3, 2017 04:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manijshrestha/7f2b70f48b8d3609bcfc371586883e35 to your computer and use it in GitHub Desktop.
Save manijshrestha/7f2b70f48b8d3609bcfc371586883e35 to your computer and use it in GitHub Desktop.
@Module class AppModule(private val context: Context) {
@Provides fun providesAppContext() = context
@Provides fun providesAppDatabase(context: Context): AppDatabase =
Room.databaseBuilder(context, AppDatabase::class.java, "my-todo-db").allowMainThreadQueries().build()
@Provides fun providesToDoDao(database: AppDatabase) = database.taskDao()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment