Skip to content

Mitigate AddProvider verse AddEntityFrameworkProvider method confusion#25451

Merged
ajcvickers merged 3 commits intomainfrom
AddWhatNow0808
Aug 11, 2021
Merged

Mitigate AddProvider verse AddEntityFrameworkProvider method confusion#25451
ajcvickers merged 3 commits intomainfrom
AddWhatNow0808

Conversation

@ajcvickers
Copy link
Contributor

By hiding the infrastructure method from Intellisense and adding docs.

Also adds Cosmos and In-Memory sugar.

Part of #24743

@ajcvickers ajcvickers requested a review from a team August 8, 2021 14:06
@ajcvickers
Copy link
Contributor Author

/cc @DamianEdwards @davidfowl

/// <param name="inMemoryOptionsAction"> An optional action to allow additional in-memory database specific configuration. </param>
/// <param name="optionsAction"> An optional action to configure the <see cref="DbContextOptions" /> for the context. </param>
/// <returns> The same service collection so that multiple calls can be chained. </returns>
public static IServiceCollection AddInMemoryDatabase<TContext>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooo I like how this reads 😃

@roji
Copy link
Member

roji commented Aug 8, 2021

We could also have the analyzer flag usages of AddEntityFrameworkProvider - opened #25455 to track this.

@ajcvickers
Copy link
Contributor Author

Note from triage: remove AddInMemoryDatabase because we want to direct people away from the in-memory database.

@DamianEdwards
Copy link
Member

@ajcvickers that's a shame as the in-memory database can be a good candidate during tutorials when the complexity of initializing and managing a storage provider adds more complexity/concepts to the learning stage than is desired. In-memory being self-initializing and requiring no separate acquisition or setup is appealing in these scenarios.

@davidfowl @LadyNaggaga

@davidfowl
Copy link
Member

Note from triage: remove AddInMemoryDatabase because we want to direct people away from the in-memory database.

Why would we remove this? It's so simple to get started and avoids the need for migrations until required.

@AndriySvyryd
Copy link
Member

Why would we remove this? It's so simple to get started and avoids the need for migrations until required.

Because it's not a real database. A lot of users expect it to have relational semantics or being production-ready. InMemoryDatabase has a very limited scope and we should steer them towards SqlServer LocalDB or Sqlite in-memory.

Microsoft has been criticized for building toy apps in tutorials using techniques that aren't acceptable in production-ready code, InMemoryDatabase certainly falls into this category.

@davidfowl
Copy link
Member

It's already in another package you have to explicitly reference. Not adding this method doesn't do anything. I think we should add the method.

You can continue to push people to SQLite but don't neuter the package arbitrarily

By hiding the infrastructure method from Intellisense and adding docs.

Also adds Cosmos and In-Memory sugar.

Part of #24743
@ajcvickers
Copy link
Contributor Author

Split out the in-memory question to #25487 so that the rest can be merged. We can continue discussion there.

@ajcvickers ajcvickers merged commit 4f50f66 into main Aug 11, 2021
@ajcvickers ajcvickers deleted the AddWhatNow0808 branch August 11, 2021 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants