Skip to content

Commit

Permalink
Fix links, versions and some texts.
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet committed Nov 22, 2024
1 parent 2134b44 commit 2a05a52
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion entity-framework/core/providers/sqlite/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Install-Package Microsoft.EntityFrameworkCore.Sqlite

## Supported Database Engines

* SQLite (3.7 onwards)
* SQLite (3.46.1 onwards)

## Limitations

Expand Down
16 changes: 8 additions & 8 deletions entity-framework/core/providers/sqlite/limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ uid: core/providers/sqlite/limitations
---
# SQLite EF Core Database Provider Limitations

The SQLite provider has a number of migrations limitations. Most of these limitations are a result of limitations in the underlying SQLite database engine and are not specific to EF.
The SQLite provider has a number of migrations limitations. Most of these limitations are a result of limitations in the underlying SQLite database engine and are not specific to EF Core.

## Modeling limitations

The common relational library (shared by Entity Framework relational database providers) defines APIs for modelling concepts that are common to most relational database engines. A couple of these concepts are not supported by the SQLite provider.
The common relational library (shared by EF Core relational database providers) defines APIs for modelling concepts that are common to most relational database engines. A couple of these concepts are not supported by the SQLite provider.

* Schemas
* Sequences
Expand All @@ -26,9 +26,9 @@ SQLite doesn't natively support the following data types. EF Core can read and w
* TimeSpan
* UInt64

Instead of `DateTimeOffset`, we recommend using DateTime values. When handling multiple time zones, we recommend converting the values to UTC before saving and then converting back to the appropriate time zone.
Instead of `DateTimeOffset`, we recommend using `DateTime` values. When handling multiple time zones, we recommend converting the values to UTC before saving and then converting back to the appropriate time zone.

The `Decimal` type provides a high level of precision. If you don't need that level of precision, however, we recommend using double instead. You can use a [value converter](xref:core/modeling/value-conversions) to continue using decimal in your classes.
The `Decimal` type provides a high level of precision. If you don't need that level of precision, however, we recommend using `Double` instead. You can use a [value converter](xref:core/modeling/value-conversions) to continue using `Decimal` in your classes.

```csharp
modelBuilder.Entity<MyEntity>()
Expand All @@ -40,7 +40,7 @@ modelBuilder.Entity<MyEntity>()

The SQLite database engine does not support a number of schema operations that are supported by the majority of other relational databases. If you attempt to apply one of the unsupported operations to a SQLite database then a `NotSupportedException` will be thrown.

A rebuild will be attempted in order to perform certain operations. Rebuilds are only possible for database artifacts that are part of your EF Core model. If a database artifact isn't part of the model--for example, if it was created manually inside a migration--then a `NotSupportedException` is still thrown.
A rebuild will be attempted in order to perform certain operations. Rebuilds are only possible for database artifacts that are part of your EF Core model. If a database artifact isn't part of the model - for example, if it was created manually inside a migration - then a `NotSupportedException` is still thrown.

Operation | Supported?
---------------------|:----------
Expand Down Expand Up @@ -70,7 +70,7 @@ Delete | ✔

### Migrations limitations workaround

You can workaround some of these limitations by manually writing code in your migrations to perform a rebuild. Table rebuilds involve creating a new table, copying data to the new table, dropping the old table, renaming the new table. You will need to use the `Sql(string)` method to perform some of these steps.
You can workaround some of these limitations by manually writing code in your migrations to perform a rebuild. Table rebuilds involve creating a new table, copying data to the new table, dropping the old table, renaming the new table. You will need to use the [`MigrationBuilder.Sql`](/dotnet/api/microsoft.entityframeworkcore.migrations.migrationbuilder.sql) method to perform some of these steps.

See [Making Other Kinds Of Table Schema Changes](https://sqlite.org/lang_altertable.html#otheralter) in the SQLite documentation for more details.

Expand All @@ -92,9 +92,9 @@ dotnet ef database update --connection "Data Source=My.db"

## Concurrent migrations protection

EF9 introduced a locking mechanism when executing migrations. It aims to protect against multiple migration executions happening simultaneously, as that could leave the database in a corrupted state. This is one of the potential problems resulting from applying migrations at runtime using the [`DbContext.Database.Migrate()`](/dotnet/api/microsoft.entityframeworkcore.relationaldatabasefacadeextensions.migrate) method (see [Applying migrations](xref:core/managing-schemas/migrations/applying) for more information). To mitigate this, EF creates an exclusive lock on the database before any migration operations are applied.
EF Core 9 introduced a locking mechanism when executing migrations. It aims to protect against multiple migration executions happening simultaneously, as that could leave the database in a corrupted state. This is one of the potential problems resulting from applying migrations at runtime using the [`DbContext.Database.Migrate()`](/dotnet/api/microsoft.entityframeworkcore.relationaldatabasefacadeextensions.migrate) method (see [Applying migrations](xref:core/managing-schemas/migrations/applying) for more information). To mitigate this, EF Core creates an exclusive lock on the database before any migration operations are applied.

Unfortunately, SQLite does not have built-in locking mechanism, so EF creates a separate table (`__EFMigrationsLock`) and uses it for locking. The lock is released when the migration completes and the seeding code finishes execution. However, if for some reason migration fails in a non-recoverable way, the lock may not be released correctly. If this happens, consecutive migrations will be blocked from executing SQL and therefore never complete. You can manually unblock them by deleting the `__EFMigrationsLock` table in the database.
Unfortunately, SQLite does not have built-in locking mechanism, so EF Core creates a separate table (`__EFMigrationsLock`) and uses it for locking. The lock is released when the migration completes and the seeding code finishes execution. However, if for some reason migration fails in a non-recoverable way, the lock may not be released correctly. If this happens, consecutive migrations will be blocked from executing SQL and therefore never complete. You can manually unblock them by deleting the `__EFMigrationsLock` table in the database.

## See also

Expand Down
6 changes: 3 additions & 3 deletions entity-framework/core/providers/sqlite/spatial.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This page includes additional information about using spatial data with the SQLi

## Installing SpatiaLite

On Windows, the native mod_spatialite library is distributed as a NuGet package dependency. Other platforms need to install it separately. This is typically done using a software package manager. For example, you can use APT on Debian and Ubuntu; and Homebrew on MacOS.
On Windows, the native `mod_spatialite` library is distributed as a [NuGet package](https://www.nuget.org/packages/mod_spatialite) dependency. Other platforms need to install it separately. This is typically done using a software package manager. For example, you can use APT on Debian and Ubuntu; and Homebrew on MacOS.

```bash
# Debian/Ubuntu
Expand Down Expand Up @@ -63,7 +63,7 @@ modelBuilder.Entity<City>().Property(c => c.Location)

## Spatial function mappings

This table shows which [NetTopologySuite](https://nettopologysuite.github.io/NetTopologySuite/) (NTS) members are translated into which SQL functions.
This table shows which [NetTopologySuite](https://github.com/NetTopologySuite/NetTopologySuite/wiki) (NTS) members are translated into which SQL functions.

.NET | SQL
------------------------------------------- | ---
Expand Down Expand Up @@ -139,4 +139,4 @@ EnvelopeCombiner.CombineAsGeometry(group.Select(x => x.Property)) | Extent(Prope
## Additional resources

* [SpatiaLite Homepage](https://www.gaia-gis.it/fossil/libspatialite)
* [NetTopologySuite Docs](https://nettopologysuite.github.io/NetTopologySuite/)
* [NetTopologySuite API Documentation](https://nettopologysuite.github.io/NetTopologySuite/api/NetTopologySuite.html)
2 changes: 1 addition & 1 deletion entity-framework/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
- name: Spatial data
displayName: GIS
href: core/providers/sqlite/spatial.md
- name: Microsoft.Data.Sqlite >>
- name: Microsoft.Data.Sqlite
href: /dotnet/standard/data/sqlite/
- name: Azure Cosmos DB
items:
Expand Down

0 comments on commit 2a05a52

Please sign in to comment.