-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
10,844 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* text=auto | ||
*.cs diff=csharp | ||
*.sh eol=lf | ||
*.sln eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.29102.190 | ||
MinimumVisualStudioVersion = 15.0.26730.03 | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CE6B50B2-34AE-44C9-940A-4E48C3E1B3BC}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maikebing.Data.Taos", "src\Maikebing.Data.Taos\Maikebing.Data.Taos.csproj", "{EFD6587E-F538-4656-95E3-514EEA16E494}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maikebing.EntityFrameworkCore.Taos", "src\EFCore.Taos.Core\Maikebing.EntityFrameworkCore.Taos.csproj", "{9D7B7248-3ADD-4DC3-A800-18CE10FEA752}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{61AA7587-946B-4B2F-92C9-73D0BA670B97}" | ||
ProjectSection(SolutionItems) = preProject | ||
README.md = README.md | ||
EndProjectSection | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{EFD6587E-F538-4656-95E3-514EEA16E494}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{EFD6587E-F538-4656-95E3-514EEA16E494}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{EFD6587E-F538-4656-95E3-514EEA16E494}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{EFD6587E-F538-4656-95E3-514EEA16E494}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{9D7B7248-3ADD-4DC3-A800-18CE10FEA752}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9D7B7248-3ADD-4DC3-A800-18CE10FEA752}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9D7B7248-3ADD-4DC3-A800-18CE10FEA752}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9D7B7248-3ADD-4DC3-A800-18CE10FEA752}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{EFD6587E-F538-4656-95E3-514EEA16E494} = {CE6B50B2-34AE-44C9-940A-4E48C3E1B3BC} | ||
{9D7B7248-3ADD-4DC3-A800-18CE10FEA752} = {CE6B50B2-34AE-44C9-940A-4E48C3E1B3BC} | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {285A5EB4-BCF4-40EB-B9E1-DF6DBCB5E705} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | ||
</packageSources> | ||
</configuration> |
30 changes: 30 additions & 0 deletions
30
src/EFCore.Taos.Core/Design/Internal/SqliteDesignTimeServices.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.Design; | ||
using Microsoft.EntityFrameworkCore.Scaffolding; | ||
using Microsoft.EntityFrameworkCore.Sqlite.Scaffolding.Internal; | ||
using Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal; | ||
using Microsoft.EntityFrameworkCore.Storage; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Sqlite.Design.Internal | ||
{ | ||
/// <summary> | ||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used | ||
/// directly from your code. This API may change or be removed in future releases. | ||
/// </summary> | ||
public class SqliteDesignTimeServices : IDesignTimeServices | ||
{ | ||
/// <summary> | ||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used | ||
/// directly from your code. This API may change or be removed in future releases. | ||
/// </summary> | ||
public virtual void ConfigureDesignTimeServices(IServiceCollection serviceCollection) | ||
=> serviceCollection | ||
.AddSingleton<IRelationalTypeMappingSource, SqliteTypeMappingSource>() | ||
.AddSingleton<IDatabaseModelFactory, SqliteDatabaseModelFactory>() | ||
.AddSingleton<IProviderConfigurationCodeGenerator, SqliteCodeGenerator>() | ||
.AddSingleton<IAnnotationCodeGenerator, AnnotationCodeGenerator>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Diagnostics; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Diagnostics | ||
{ | ||
/// <summary> | ||
/// <para> | ||
/// Event IDs for SQLite events that correspond to messages logged to an <see cref="ILogger" /> | ||
/// and events sent to a <see cref="DiagnosticSource" />. | ||
/// </para> | ||
/// <para> | ||
/// These IDs are also used with <see cref="WarningsConfigurationBuilder" /> to configure the | ||
/// behavior of warnings. | ||
/// </para> | ||
/// </summary> | ||
public static class SqliteEventId | ||
{ | ||
// Warning: These values must not change between releases. | ||
// Only add new values to the end of sections, never in the middle. | ||
// Try to use <Noun><Verb> naming and be consistent with existing names. | ||
private enum Id | ||
{ | ||
// Model validation events | ||
SchemaConfiguredWarning = CoreEventId.ProviderBaseId, | ||
SequenceConfiguredWarning, | ||
|
||
// Scaffolding events | ||
ColumnFound = CoreEventId.ProviderDesignBaseId, | ||
ForeignKeyFound, | ||
ForeignKeyPrincipalColumnMissingWarning, | ||
ForeignKeyReferencesMissingTableWarning, | ||
IndexFound, | ||
MissingTableWarning, | ||
PrimaryKeyFound, | ||
SchemasNotSupportedWarning, | ||
TableFound, | ||
UniqueConstraintFound | ||
} | ||
|
||
private static readonly string _validationPrefix = DbLoggerCategory.Model.Validation.Name + "."; | ||
private static EventId MakeValidationId(Id id) => new EventId((int)id, _validationPrefix + id); | ||
|
||
/// <summary> | ||
/// <para> | ||
/// A schema was configured for an entity type, but SQLite does not support schemas. | ||
/// </para> | ||
/// <para> | ||
/// This event is in the <see cref="DbLoggerCategory.Model.Validation" /> category. | ||
/// </para> | ||
/// <para> | ||
/// This event uses the <see cref="EntityTypeSchemaEventData" /> payload when used with a <see cref="DiagnosticSource" />. | ||
/// </para> | ||
/// </summary> | ||
public static readonly EventId SchemaConfiguredWarning = MakeValidationId(Id.SchemaConfiguredWarning); | ||
|
||
/// <summary> | ||
/// <para> | ||
/// A sequence was configured for an entity type, but SQLite does not support sequences. | ||
/// </para> | ||
/// <para> | ||
/// This event is in the <see cref="DbLoggerCategory.Model.Validation" /> category. | ||
/// </para> | ||
/// <para> | ||
/// This event uses the <see cref="SequenceEventData" /> payload when used with a <see cref="DiagnosticSource" />. | ||
/// </para> | ||
/// </summary> | ||
public static readonly EventId SequenceConfiguredWarning = MakeValidationId(Id.SequenceConfiguredWarning); | ||
|
||
private static readonly string _scaffoldingPrefix = DbLoggerCategory.Scaffolding.Name + "."; | ||
private static EventId MakeScaffoldingId(Id id) => new EventId((int)id, _scaffoldingPrefix + id); | ||
|
||
/// <summary> | ||
/// A column was found. | ||
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category. | ||
/// </summary> | ||
public static readonly EventId ColumnFound = MakeScaffoldingId(Id.ColumnFound); | ||
|
||
/// <summary> | ||
/// SQLite does not support schemas. | ||
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category. | ||
/// </summary> | ||
public static readonly EventId SchemasNotSupportedWarning = MakeScaffoldingId(Id.SchemasNotSupportedWarning); | ||
|
||
/// <summary> | ||
/// A foreign key references a missing table. | ||
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category. | ||
/// </summary> | ||
public static readonly EventId ForeignKeyReferencesMissingTableWarning = MakeScaffoldingId(Id.ForeignKeyReferencesMissingTableWarning); | ||
|
||
/// <summary> | ||
/// A table was found. | ||
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category. | ||
/// </summary> | ||
public static readonly EventId TableFound = MakeScaffoldingId(Id.TableFound); | ||
|
||
/// <summary> | ||
/// The database is missing a table. | ||
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category. | ||
/// </summary> | ||
public static readonly EventId MissingTableWarning = MakeScaffoldingId(Id.MissingTableWarning); | ||
|
||
/// <summary> | ||
/// A column referenced by a foreign key constraint was not found. | ||
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category. | ||
/// </summary> | ||
public static readonly EventId ForeignKeyPrincipalColumnMissingWarning = MakeScaffoldingId(Id.ForeignKeyPrincipalColumnMissingWarning); | ||
|
||
/// <summary> | ||
/// An index was found. | ||
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category. | ||
/// </summary> | ||
public static readonly EventId IndexFound = MakeScaffoldingId(Id.IndexFound); | ||
|
||
/// <summary> | ||
/// A foreign key was found. | ||
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category. | ||
/// </summary> | ||
public static readonly EventId ForeignKeyFound = MakeScaffoldingId(Id.ForeignKeyFound); | ||
|
||
/// <summary> | ||
/// A primary key was found. | ||
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category. | ||
/// </summary> | ||
public static readonly EventId PrimaryKeyFound = MakeScaffoldingId(Id.PrimaryKeyFound); | ||
|
||
/// <summary> | ||
/// A unique constraint was found. | ||
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category. | ||
/// </summary> | ||
public static readonly EventId UniqueConstraintFound = MakeScaffoldingId(Id.UniqueConstraintFound); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/EFCore.Taos.Core/Extensions/SqliteMetadataExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using JetBrains.Annotations; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Utilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore | ||
{ | ||
/// <summary> | ||
/// SQLite specific extension methods for metadata. | ||
/// </summary> | ||
public static class SqliteMetadataExtensions | ||
{ | ||
/// <summary> | ||
/// Gets the SQLite specific metadata for a property. | ||
/// </summary> | ||
/// <param name="property"> The property to get metadata for. </param> | ||
/// <returns> The SQLite specific metadata for the property. </returns> | ||
public static SqlitePropertyAnnotations Sqlite([NotNull] this IMutableProperty property) | ||
=> (SqlitePropertyAnnotations)Sqlite((IProperty)property); | ||
|
||
/// <summary> | ||
/// Gets the SQLite specific metadata for a property. | ||
/// </summary> | ||
/// <param name="property"> The property to get metadata for. </param> | ||
/// <returns> The SQLite specific metadata for the property. </returns> | ||
public static ISqlitePropertyAnnotations Sqlite([NotNull] this IProperty property) | ||
=> new SqlitePropertyAnnotations(Check.NotNull(property, nameof(property))); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/EFCore.Taos.Core/Extensions/SqlitePropertyBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using JetBrains.Annotations; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using Microsoft.EntityFrameworkCore.Utilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore | ||
{ | ||
/// <summary> | ||
/// SQLite specific extension methods for <see cref="PropertyBuilder" />. | ||
/// </summary> | ||
public static class SqlitePropertyBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Configures the SRID of the column that the property maps to when targeting SQLite. | ||
/// </summary> | ||
/// <param name="propertyBuilder"> The builder for the property being configured. </param> | ||
/// <param name="srid"> The SRID. </param> | ||
/// <returns> The same builder instance so that multiple calls can be chained. </returns> | ||
public static PropertyBuilder ForSqliteHasSrid([NotNull] this PropertyBuilder propertyBuilder, int srid) | ||
{ | ||
Check.NotNull(propertyBuilder, nameof(propertyBuilder)); | ||
|
||
propertyBuilder.Metadata.Sqlite().Srid = srid; | ||
|
||
return propertyBuilder; | ||
} | ||
|
||
/// <summary> | ||
/// Configures the SRID of the column that the property maps to when targeting SQLite. | ||
/// </summary> | ||
/// <param name="propertyBuilder"> The builder for the property being configured. </param> | ||
/// <param name="srid"> The SRID. </param> | ||
/// <returns> The same builder instance so that multiple calls can be chained. </returns> | ||
public static PropertyBuilder<TProperty> ForSqliteHasSrid<TProperty>( | ||
[NotNull] this PropertyBuilder<TProperty> propertyBuilder, | ||
int srid) | ||
=> (PropertyBuilder<TProperty>)ForSqliteHasSrid((PropertyBuilder)propertyBuilder, srid); | ||
} | ||
} |
Oops, something went wrong.