-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RavenDB client & hosting integration (#397)
* RavenDB-Aspire - Implement RavenDB client & hosting integration * RavenDB-Aspire - fixed PR comments * RavenDB-Aspire: - fix client integration - change ConnectionStringExpression format to "URL={Url};Database={DatabaseName}" - expand example to include the client library - fix README.md files - fix and add tests * Update Directory.Packages.props * RavenDB-Aspire - update CODEOWNERS & README.md --------- Co-authored-by: Aaron Powell <[email protected]>
- Loading branch information
1 parent
834360f
commit 7250acb
Showing
36 changed files
with
2,245 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
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
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
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
13 changes: 13 additions & 0 deletions
13
...pire.Hosting.RavenDB.ApiService/CommunityToolkit.Aspire.Hosting.RavenDB.ApiService.csproj
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,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\src\CommunityToolkit.Aspire.RavenDB.Client\CommunityToolkit.Aspire.RavenDB.Client.csproj" /> | ||
<ProjectReference Include="..\CommunityToolkit.Aspire.Hosting.RavenDB.ServiceDefaults\CommunityToolkit.Aspire.Hosting.RavenDB.ServiceDefaults.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
46 changes: 46 additions & 0 deletions
46
examples/ravendb/CommunityToolkit.Aspire.Hosting.RavenDB.ApiService/Program.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,46 @@ | ||
using Raven.Client.Documents; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.AddServiceDefaults(); | ||
builder.AddRavenDBClient(connectionName: "ravendb", configureSettings: settings => | ||
{ | ||
settings.CreateDatabase = true; | ||
settings.DatabaseName = "ravenDatabase"; | ||
}); | ||
|
||
var app = builder.Build(); | ||
|
||
app.MapGet("/create", async (IDocumentStore documentStore) => | ||
{ | ||
using var session = documentStore.OpenAsyncSession(); | ||
var company = new Company | ||
{ | ||
Name = "RavenDB", | ||
Phone = "(26) 642-7012", | ||
Fax = "(26) 642-7012" | ||
}; | ||
|
||
await session.StoreAsync(company, "companies/ravendb"); | ||
await session.SaveChangesAsync(); | ||
}); | ||
|
||
app.MapGet("/get", async (IDocumentStore documentStore) => | ||
{ | ||
using var session = documentStore.OpenAsyncSession(); | ||
var company = await session.LoadAsync<Company>("companies/ravendb"); | ||
return company; | ||
}); | ||
|
||
app.MapDefaultEndpoints(); | ||
|
||
app.Run(); | ||
|
||
|
||
public class Company | ||
{ | ||
public string? Id { get; set; } | ||
public string? Name { get; set; } | ||
public string? Phone { get; set; } | ||
public string? Fax { get; set; } | ||
} |
12 changes: 12 additions & 0 deletions
12
...ravendb/CommunityToolkit.Aspire.Hosting.RavenDB.ApiService/Properties/launchSettings.json
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,12 @@ | ||
{ | ||
"profiles": { | ||
"CommunityToolkit.Aspire.Hosting.RavenDB.ApiService": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "http://localhost:54649" | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
examples/ravendb/CommunityToolkit.Aspire.Hosting.RavenDB.ApiService/RavenDB.ApiService.http
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 @@ | ||
@ApiService_HostAddress = http://localhost:54649 | ||
|
||
GET {{ApiService_HostAddress}}/ | ||
Accept: application/json | ||
|
||
### |
21 changes: 21 additions & 0 deletions
21
...ng.RavenDB.ServiceDefaults/CommunityToolkit.Aspire.Hosting.RavenDB.ServiceDefaults.csproj
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,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<IsAspireSharedProject>true</IsAspireSharedProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<FrameworkReference Include="Microsoft.AspNetCore.App" /> | ||
|
||
<PackageReference Include="Microsoft.Extensions.Http.Resilience" /> | ||
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" /> | ||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" /> | ||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" /> | ||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" /> | ||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" /> | ||
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.