Database.Login EF6 by providing a simple way to get logs from EF Core without the need to configure any kind of external logging framework.
ToQueryStringextension method, which will return the SQL that EF Core will generate when executing a LINQ query.
DbContextinstance without any connection or connection string.
IsRelationalmethod has been added in addition to the existing
IsInMemory. This method can be used to test if the DbContext is using any relational database provider.
ETags. Use the model builder in
OnModelCreatingto configure an
SaveChangeswill then throw a
DbUpdateConcurrencyExceptionon a concurrency conflict, which can be handled to implement retries, etc.
DateTimeconstruction is now translated.
SequenceEqual, etc. on
byteproperties are now translated to SQL.
Reverseare now translated.
EndsWithare now translated when using the Azure Cosmos DB provider.
GetTextReaderis now more efficient by making use of SqliteBlob and streams.
SqliteConnectionis now lazy.
Microsoft.Data.Sqliteprovider and hence also improve performance outside of EF Core.
Includemethod now supports filtering of the entities included.
Navigationmethod can be used in cases where navigation properties need an additional configuration. For example, to set a backing field for the navigation when the field would not be found by convention.
NavigationAPI does not replace relationship configuration. Instead, it allows additional configuration of navigation properties in already discovered or defined relationships.
EnableDetailedErrorswill add extra null checking to queries such that, for a small performance overhead, these errors are easier to trace back to a root cause.
EF.Functions.Collate()allows for ad-hoc queries using different collations.
IDesignTimeDbContextFactory. For example, to indicate this is a dev build, a custom argument (e.g.
dev) can be passed on the command line.
PerformIdentityResolutionthe syntax will be changed.
Includeor a projection to bring back multiple related collections.
AsSplitQueryAPI can be used to change this behavior.
AsSplitQueryis available for all relational database providers and can be used anywhere in the query, just like
AsNoTracking. EF Core will now generate the following three SQL queries.
FirstOrDefaultand similar single result selecting operations.
Takeare not supported in preview 6, but are available in the daily builds and will be included in preview 7.
AsSplitQuerymethod can also be used when collections are loaded in projections.
e.Albumsin the above case won't result in a split query.
IndexAttributecan be placed on an entity type to specify an index for a single column.
IsSignedis not mapped.
IPAddressclass is now automatically mapped to a string column for databases that do not already have native support. For example, consider mapping this entity type.
DbContextis scaffolded from an existing database, EF Core by default creates an
OnConfiguringoverload with a connection string so that the context is immediately usable. However, this is not useful if you already have a partial class with
OnConfiguring, or if you are configuring the context some other way.
FirstOrDefaultand similar operators for characters in strings are now translated in a LINQ query.
AddPooledDbContextFactoryto register a factory for creating
DbContextinstances in the application's dependency injection container.
IDbContextFactory<TContext>in the service constructor.
DbContextinstances can then be created and used as needed.
DbContextinstances created in this way are not managed by the application's service provider and therefore must be disposed of by the application.
IDbContextFactoryis recommended, but may also be useful in other scenarios.
AddDbContextPool, and also has the same limitations.
ChangeTracker.Clear()which clears the
DbContextof all tracked entities.
DbContextinstance, then using the new
Clear()method is more performant and robust than mass-detaching all entities.
nullwithout impacting the public surface of the entity type.
IsValidis never set, then the database default will be used since the backing field remains null.
falseare set, then this value is saved explicitly to the database.
ConnectionMode.Gateway, which is generally more compatible.
Addressesresulted in entity types named
Addresseswill now be reverse engineered to entity types named
SaveChangesfails. This allows SaveChanges to be re-tried without re-trying the entire transaction.
Unicornstable created for a