You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using CacheService;
|
|
|
|
|
using CommonExtend;
|
|
|
|
|
using Dapr.Client;
|
|
|
|
|
using LanShengInterface;
|
|
|
|
|
using LanShengService.Tcp;
|
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace LanShengService
|
|
|
|
|
{
|
|
|
|
|
public static class LanShengServiceExtend
|
|
|
|
|
{
|
|
|
|
|
public static IServiceCollection InitLanShengService(this IServiceCollection services, IConfiguration configuration)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig()
|
|
|
|
|
{
|
|
|
|
|
DbType = SqlSugar.DbType.MySql,
|
|
|
|
|
ConnectionString = configuration.GetConnectionString("Default"),
|
|
|
|
|
IsAutoCloseConnection = true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
services.AddSingleton<ISqlSugarClient>(sqlSugar);
|
|
|
|
|
services.AddSingleton<ITcpService, TcpService>();
|
|
|
|
|
services.AddSingleton<IDeviceService, DeviceService>();
|
|
|
|
|
services.InitMemoryCacheService();
|
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IApplicationBuilder CreateLanShengService(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
app.ApplicationServices.GetRequiredService<ITcpService>();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return app;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LanShengService
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|