Skip to content

Commit

Permalink
SQLite integrations (#372)
Browse files Browse the repository at this point in the history
* Initial work on the SQLite hosting integration

* Adding sqlite client integration

* Adding an extended default timeout when using the web container to avoid locking issues

* Implementing ef client for sqlite

Also, finally figured out why db was getting read-only errors, need to set unix file system permissions explicitly%

* sqlite hosting tests

* Implementing tests for sqlite client integration

* Reverting accidentally enabling tests

* Adding sqlite ef test set

* Adding readme's for integrations

Also decided to rename the method to AddSqliteConnection to be clearer as to what you're adding

* Initial work on the SQLite hosting integration

* Adding sqlite client integration

* Adding an extended default timeout when using the web container to avoid locking issues

* Implementing ef client for sqlite

Also, finally figured out why db was getting read-only errors, need to set unix file system permissions explicitly%

* sqlite hosting tests

* Implementing tests for sqlite client integration

* Reverting accidentally enabling tests

* Adding sqlite ef test set

* Adding readme's for integrations

Also decided to rename the method to AddSqliteConnection to be clearer as to what you're adding

* Applying code review feedback

* Initial work on the SQLite hosting integration

* Adding sqlite client integration

* Adding an extended default timeout when using the web container to avoid locking issues

* Implementing ef client for sqlite

Also, finally figured out why db was getting read-only errors, need to set unix file system permissions explicitly%

* sqlite hosting tests

* Implementing tests for sqlite client integration

* Reverting accidentally enabling tests

* Adding sqlite ef test set

* Adding readme's for integrations

Also decided to rename the method to AddSqliteConnection to be clearer as to what you're adding

* Initial work on the SQLite hosting integration

* Adding sqlite client integration

* Adding an extended default timeout when using the web container to avoid locking issues

* Implementing ef client for sqlite

Also, finally figured out why db was getting read-only errors, need to set unix file system permissions explicitly%

* sqlite hosting tests

* Implementing tests for sqlite client integration

* Reverting accidentally enabling tests

* Adding sqlite ef test set

* Adding readme's for integrations

Also decided to rename the method to AddSqliteConnection to be clearer as to what you're adding

* Applying code review feedback

* Update src/CommunityToolkit.Aspire.Hosting.Sqlite/CommunityToolkit.Aspire.Hosting.Sqlite.csproj

Co-authored-by: Alireza Baloochi  <[email protected]>

* Updating readme

---------

Co-authored-by: Alireza Baloochi <[email protected]>
  • Loading branch information
aaronpowell and Alirexaa authored Jan 15, 2025
1 parent c50a1bd commit 3994771
Show file tree
Hide file tree
Showing 52 changed files with 1,989 additions and 7 deletions.
76 changes: 76 additions & 0 deletions CommunityToolkit.Aspire.sln
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,26 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hos
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hosting.Ngrok.Tests", "tests\CommunityToolkit.Aspire.Hosting.Ngrok.Tests\CommunityToolkit.Aspire.Hosting.Ngrok.Tests.csproj", "{31D2ECC1-15EA-4850-88E9-A5F967D742C9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hosting.Sqlite", "src\CommunityToolkit.Aspire.Hosting.Sqlite\CommunityToolkit.Aspire.Hosting.Sqlite.csproj", "{BEA41234-DFF9-49AE-AD6C-42A9D54202E7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sqlite", "sqlite", "{6782F1C1-5146-549F-82A8-60C82F1C7F16}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Sqlite.AppHost", "examples\sqlite\CommunityToolkit.Aspire.Sqlite.AppHost\CommunityToolkit.Aspire.Sqlite.AppHost.csproj", "{97E455C1-C914-4C51-87A9-2C213CE2ED5B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Microsoft.Data.Sqlite", "src\CommunityToolkit.Aspire.Microsoft.Data.Sqlite\CommunityToolkit.Aspire.Microsoft.Data.Sqlite.csproj", "{5DF8F833-F6F8-4C9C-ABEC-80EC0C734A88}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Sqlite.Api", "examples\sqlite\CommunityToolkit.Aspire.Sqlite.Api\CommunityToolkit.Aspire.Sqlite.Api.csproj", "{E48F6DDD-D62D-4723-810D-0F178C35E8B8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Sqlite.ServiceDefaults", "examples\sqlite\CommunityToolkit.Aspire.Sqlite.ServiceDefaults\CommunityToolkit.Aspire.Sqlite.ServiceDefaults.csproj", "{DD7042A1-8E44-40A8-B338-DC2F7B755702}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite", "src\CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite\CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite.csproj", "{E54E9DCA-1420-4306-83B6-D45D6EC49DBF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hosting.Sqlite.Tests", "tests\CommunityToolkit.Aspire.Hosting.Sqlite.Tests\CommunityToolkit.Aspire.Hosting.Sqlite.Tests.csproj", "{0E6EBCFB-DEF5-496C-95AF-00884826CFC8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Microsoft.Data.Sqlite.Tests", "tests\CommunityToolkit.Aspire.Microsoft.Data.Sqlite.Tests\CommunityToolkit.Aspire.Microsoft.Data.Sqlite.Tests.csproj", "{861FE61C-90EE-49B0-BCC8-8417C293CC21}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite.Tests", "tests\CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite.Tests\CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite.Tests.csproj", "{52846E18-99D1-4040-AF5F-17FC69198BCE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -523,6 +543,42 @@ Global
{31D2ECC1-15EA-4850-88E9-A5F967D742C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31D2ECC1-15EA-4850-88E9-A5F967D742C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31D2ECC1-15EA-4850-88E9-A5F967D742C9}.Release|Any CPU.Build.0 = Release|Any CPU
{BEA41234-DFF9-49AE-AD6C-42A9D54202E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEA41234-DFF9-49AE-AD6C-42A9D54202E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEA41234-DFF9-49AE-AD6C-42A9D54202E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEA41234-DFF9-49AE-AD6C-42A9D54202E7}.Release|Any CPU.Build.0 = Release|Any CPU
{97E455C1-C914-4C51-87A9-2C213CE2ED5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97E455C1-C914-4C51-87A9-2C213CE2ED5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97E455C1-C914-4C51-87A9-2C213CE2ED5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97E455C1-C914-4C51-87A9-2C213CE2ED5B}.Release|Any CPU.Build.0 = Release|Any CPU
{5DF8F833-F6F8-4C9C-ABEC-80EC0C734A88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DF8F833-F6F8-4C9C-ABEC-80EC0C734A88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DF8F833-F6F8-4C9C-ABEC-80EC0C734A88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DF8F833-F6F8-4C9C-ABEC-80EC0C734A88}.Release|Any CPU.Build.0 = Release|Any CPU
{E48F6DDD-D62D-4723-810D-0F178C35E8B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E48F6DDD-D62D-4723-810D-0F178C35E8B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E48F6DDD-D62D-4723-810D-0F178C35E8B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E48F6DDD-D62D-4723-810D-0F178C35E8B8}.Release|Any CPU.Build.0 = Release|Any CPU
{DD7042A1-8E44-40A8-B338-DC2F7B755702}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD7042A1-8E44-40A8-B338-DC2F7B755702}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD7042A1-8E44-40A8-B338-DC2F7B755702}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD7042A1-8E44-40A8-B338-DC2F7B755702}.Release|Any CPU.Build.0 = Release|Any CPU
{E54E9DCA-1420-4306-83B6-D45D6EC49DBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E54E9DCA-1420-4306-83B6-D45D6EC49DBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E54E9DCA-1420-4306-83B6-D45D6EC49DBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E54E9DCA-1420-4306-83B6-D45D6EC49DBF}.Release|Any CPU.Build.0 = Release|Any CPU
{0E6EBCFB-DEF5-496C-95AF-00884826CFC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E6EBCFB-DEF5-496C-95AF-00884826CFC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E6EBCFB-DEF5-496C-95AF-00884826CFC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E6EBCFB-DEF5-496C-95AF-00884826CFC8}.Release|Any CPU.Build.0 = Release|Any CPU
{861FE61C-90EE-49B0-BCC8-8417C293CC21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{861FE61C-90EE-49B0-BCC8-8417C293CC21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{861FE61C-90EE-49B0-BCC8-8417C293CC21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{861FE61C-90EE-49B0-BCC8-8417C293CC21}.Release|Any CPU.Build.0 = Release|Any CPU
{52846E18-99D1-4040-AF5F-17FC69198BCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52846E18-99D1-4040-AF5F-17FC69198BCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52846E18-99D1-4040-AF5F-17FC69198BCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52846E18-99D1-4040-AF5F-17FC69198BCE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -624,6 +680,26 @@ Global
{1E18FE0B-C6DF-4935-AD43-4FEE73ED810C} = {7431DE02-23CA-4024-B22D-FCF008AFE3CB}
{59101126-7BD2-4E03-9C4D-D0D01AD14674} = {7431DE02-23CA-4024-B22D-FCF008AFE3CB}
{31D2ECC1-15EA-4850-88E9-A5F967D742C9} = {899F0713-7FC6-4750-BAFC-AC650B35B453}
{BEA41234-DFF9-49AE-AD6C-42A9D54202E7} = {414151D4-7009-4E78-A5C6-D99EBD1E67D1}
{6782F1C1-5146-549F-82A8-60C82F1C7F16} = {8519CC01-1370-47C8-AD94-B0F326B1563F}
{97E455C1-C914-4C51-87A9-2C213CE2ED5B} = {6782F1C1-5146-549F-82A8-60C82F1C7F16}
{5DF8F833-F6F8-4C9C-ABEC-80EC0C734A88} = {414151D4-7009-4E78-A5C6-D99EBD1E67D1}
{E48F6DDD-D62D-4723-810D-0F178C35E8B8} = {6782F1C1-5146-549F-82A8-60C82F1C7F16}
{DD7042A1-8E44-40A8-B338-DC2F7B755702} = {6782F1C1-5146-549F-82A8-60C82F1C7F16}
{E54E9DCA-1420-4306-83B6-D45D6EC49DBF} = {414151D4-7009-4E78-A5C6-D99EBD1E67D1}
{0E6EBCFB-DEF5-496C-95AF-00884826CFC8} = {899F0713-7FC6-4750-BAFC-AC650B35B453}
{861FE61C-90EE-49B0-BCC8-8417C293CC21} = {899F0713-7FC6-4750-BAFC-AC650B35B453}
{52846E18-99D1-4040-AF5F-17FC69198BCE} = {899F0713-7FC6-4750-BAFC-AC650B35B453}
{BEA41234-DFF9-49AE-AD6C-42A9D54202E7} = {414151D4-7009-4E78-A5C6-D99EBD1E67D1}
{6782F1C1-5146-549F-82A8-60C82F1C7F16} = {8519CC01-1370-47C8-AD94-B0F326B1563F}
{97E455C1-C914-4C51-87A9-2C213CE2ED5B} = {6782F1C1-5146-549F-82A8-60C82F1C7F16}
{5DF8F833-F6F8-4C9C-ABEC-80EC0C734A88} = {414151D4-7009-4E78-A5C6-D99EBD1E67D1}
{E48F6DDD-D62D-4723-810D-0F178C35E8B8} = {6782F1C1-5146-549F-82A8-60C82F1C7F16}
{DD7042A1-8E44-40A8-B338-DC2F7B755702} = {6782F1C1-5146-549F-82A8-60C82F1C7F16}
{E54E9DCA-1420-4306-83B6-D45D6EC49DBF} = {414151D4-7009-4E78-A5C6-D99EBD1E67D1}
{0E6EBCFB-DEF5-496C-95AF-00884826CFC8} = {899F0713-7FC6-4750-BAFC-AC650B35B453}
{861FE61C-90EE-49B0-BCC8-8417C293CC21} = {899F0713-7FC6-4750-BAFC-AC650B35B453}
{52846E18-99D1-4040-AF5F-17FC69198BCE} = {899F0713-7FC6-4750-BAFC-AC650B35B453}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {08B1D4B8-D2C5-4A64-BB8B-E1A2B29525F0}
Expand Down
8 changes: 8 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
<PackageVersion Include="Aspire.Hosting.SqlServer" Version="$(AspireVersion)" />
<!-- AspNetCore packages -->
<PackageVersion Include="AspNetCore.HealthChecks.EventStore.gRPC" Version="9.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.Sqlite" Version="9.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.SqlServer" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.QuickGrid" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.11" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageVersion>
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="$(DotNetExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(DotNetExtensionsVersion)" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="7.2.0" />
Expand Down Expand Up @@ -47,6 +52,9 @@
<PackageVersion Include="MassTransit" Version="8.3.4" />
<PackageVersion Include="MassTransit.ActiveMQ" Version="8.3.1" />
<PackageVersion Include="MeiliSearch" Version="0.15.5" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.11" />
<PackageVersion Include="Microsoft.SqlServer.DacFx" Version="162.5.57" />
<PackageVersion Include="Microsoft.Build" Version="17.11.4" />
<PackageVersion Include="Microsoft.Build.Locator" Version="1.7.8" />
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ This repository contains the source code for the .NET Aspire Community Toolkit,
| - **Learn More**: [`Hosting.EventStore`][eventstore-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.EventStore][eventstore-shields]][eventstore-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.EventStore][eventstore-shields-preview]][eventstore-nuget-preview] | An Aspire hosting integration leveraging the [EventStore](https://eventstore.com) container. |
| - **Learn More**: [`EventStore`][eventstore-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.EventStore][eventstore-client-shields]][eventstore-client-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.EventStore][eventstore-client-shields-preview]][eventstore-client-nuget-preview] | An Aspire client integration for the [EventStore](https://github.com/EventStore/EventStore-Client-Dotnet) package. |
| - **Learn More**: [`Hosting.ActiveMQ`][activemq-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.ActiveMQ][activemq-shields]][activemq-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.ActiveMQ][activemq-shields-preview]][activemq-nuget-preview] | An Aspire hosting integration leveraging the [ActiveMq](https://activemq.apache.org) container. |
| - **Learn More**: [`Hosting.Sqlite`][sqlite-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.Sqlite][sqlite-shields]][sqlite-hosting-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.Sqlite][sqlite-shields-preview]][sqlite-hosting-nuget-preview] | An Aspire hosting integration to setup a SQLite database with optional SQLite Web as a dev UI. |
| - **Learn More**: [`Microsoft.Data.Sqlite`][sqlite-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Microsoft.Data.Sqlite][sqlite-shields]][sqlite-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Microsoft.Data.Sqlite][sqlite-shields-preview]][sqlite-nuget-preview] | An Aspire client integration for the Microsoft.Data.Sqlite NuGet package. |
| - **Learn More**: [`Microsoft.EntityFrameworkCore.Sqlite`][sqlite-ef-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite][sqlite-ef-shields]][sqlite-ef-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite][sqlite-ef-shields-preview]][sqlite-ef-nuget-preview] | An Aspire client integration for the Microsoft.EntityFrameworkCore.Sqlite NuGet package. |

## 🙌 Getting Started

Expand Down Expand Up @@ -153,4 +156,17 @@ This project is supported by the [.NET Foundation](https://dotnetfoundation.org)
[activemq-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.ActiveMQ/
[activemq-shields-preview]: https://img.shields.io/nuget/vpre/CommunityToolkit.Aspire.Hosting.ActiveMQ?label=nuget%20(preview)
[activemq-nuget-preview]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.ActiveMQ/absoluteLatest

[sqlite-integration-docs]: https://learn.microsoft.com/dotnet/aspire/community-toolkit/sqlite
[sqlite-hosting-shields]: https://img.shields.io/nuget/v/CommunityToolkit.Aspire.Hosting.Sqlite
[sqlite-hosting-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.Sqlite/
[sqlite-hosting-shields-preview]: https://img.shields.io/nuget/vpre/CommunityToolkit.Aspire.Hosting.Sqlite?label=nuget%20(preview)
[sqlite-hosting-nuget-preview]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.Sqlite/absoluteLatest
[sqlite-shields]: https://img.shields.io/nuget/v/CommunityToolkit.Aspire.Microsoft.Data.Sqlite
[sqlite-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Microsoft.Data.Sqlite/
[sqlite-shields-preview]: https://img.shields.io/nuget/vpre/CommunityToolkit.Aspire.Microsoft.Data.Sqlite?label=nuget%20(preview)
[sqlite-nuget-preview]: https://nuget.org/packages/CommunityToolkit.Aspire.Microsoft.Data.Sqlite/absoluteLatest
[sqlite-ef-integration-docs]: https://learn.microsoft.com/dotnet/aspire/community-toolkit/sqlite-entity-framework-integration
[sqlite-ef-shields]: https://img.shields.io/nuget/v/CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite
[sqlite-ef-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite/
[sqlite-ef-shields-preview]: https://img.shields.io/nuget/vpre/CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite?label=nuget%20(preview)
[sqlite-ef-nuget-preview]: https://nuget.org/packages/CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite/absoluteLatest
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.EntityFrameworkCore;

namespace CommunityToolkit.Aspire.Sqlite.Api;

public class BloggingContext(DbContextOptions<BloggingContext> options) : DbContext(options)
{
public DbSet<Blog> Blogs { get; set; }
public DbSet<Post> Posts { get; set; }
}

public class Blog
{
public int BlogId { get; set; }
public required string Url { get; set; }

public List<Post> Posts { get; } = new();
}

public class Post
{
public int PostId { get; set; }
public required string Title { get; set; }
public required string Content { get; set; }

public int BlogId { get; set; }
public Blog? Blog { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<ItemGroup>
<ProjectReference Include="../../../src/CommunityToolkit.Aspire.Microsoft.Data.Sqlite/CommunityToolkit.Aspire.Microsoft.Data.Sqlite.csproj" />
<ProjectReference Include="../../../src/CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite/CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite.csproj" />
<ProjectReference Include="../CommunityToolkit.Aspire.Sqlite.ServiceDefaults/CommunityToolkit.Aspire.Sqlite.ServiceDefaults.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3994771

Please sign in to comment.