Rename the client service class/file from [Module]Service to Client[Module]Service and the server service to Server[Module]Service. Update Edit.razor and Index.razor to inject Client[Module]Service and adjust all calls accordingly. Update DI registration in ClientStartup to register Client[Module]Service. Also remove the System.Net.Http.Json package reference from the client .csproj. File renames and reference updates keep class names and registrations consistent between client and server templates.
19 lines
510 B
C#
19 lines
510 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using System.Linq;
|
|
using Oqtane.Services;
|
|
using [Owner].Module.[Module].Services;
|
|
|
|
namespace [Owner].Module.[Module].Startup
|
|
{
|
|
public class ClientStartup : IClientStartup
|
|
{
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
if (!services.Any(s => s.ServiceType == typeof(I[Module]Service)))
|
|
{
|
|
services.AddScoped<I[Module]Service, Client[Module]Service>();
|
|
}
|
|
}
|
|
}
|
|
}
|