Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CommanderGQL.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL.Server.Ui.Voyager" Version="4.4.1" />
<PackageReference Include="HotChocolate.AspNetCore" Version="11.0.8" />
<PackageReference Include="HotChocolate.Data.Entityframework" Version="11.0.8" />
<PackageReference Include="Microsoft.EntityframeworkCore.Design" Version="5.0.2">
<PackageReference Include="GraphQL.Server.Ui.Voyager" Version="7.2.0" />
<PackageReference Include="HotChocolate.AspNetCore" Version="13.0.2" />
<PackageReference Include="HotChocolate.Data.Entityframework" Version="13.0.2" />
<PackageReference Include="Microsoft.EntityframeworkCore.Design" Version="7.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityframeworkCore.SqlServer" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityframeworkCore.SqlServer" Version="7.0.2" />
</ItemGroup>

</Project>
</Project>
57 changes: 35 additions & 22 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using CommanderGQL.Data;
using CommanderGQL.GraphQL;
using GraphQL.Server.Ui.Voyager;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Builder;
using CommanderGQL.GraphQL.Commands;
using Microsoft.EntityFrameworkCore;
using CommanderGQL.GraphQL.Platforms;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace CommanderGQL
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddPooledDbContextFactory<AppDbContext>(opt =>
opt.UseSqlServer(builder.Configuration.GetConnectionString("CommandConStr")));
builder.Services
.AddGraphQLServer()
.AddQueryType<Query>()
.AddMutationType<Mutation>()
.AddSubscriptionType<Subscription>()
.ModifyRequestOptions(opt => opt.IncludeExceptionDetails = builder.Environment.IsDevelopment())
.AddType<PlatformType>()
.AddType<CommandType>()
.AddFiltering()
.AddSorting()
.AddInMemorySubscriptions();

var app = builder.Build();
app.UseWebSockets();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGraphQL();
});
app.UseGraphQLVoyager("/graphql-voyager", new VoyagerOptions()
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
GraphQLEndPoint = "/graphql"
});

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
app.Run();
75 changes: 0 additions & 75 deletions Startup.cs

This file was deleted.