LFlow/LFlow.Home/HomeModule.cs

41 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Reflection;
using LFlow.Base.BusinessInterface;
using LFlow.Base.Interfaces;
using LFlow.Base.Utils;
using LFlow.Home.Models.DataModels;
using LFlow.Home.Models.DtoModel;
using LFlow.Home.Services;
using Microsoft.Extensions.DependencyInjection;
namespace LFlow.Home;
/// <summary>
/// 首页模块
/// </summary>
public class HomeModule : IModule
{
/// <summary>
/// 配置模块
/// </summary>
/// <param name="services">启动前的IServiceCollection</param>
public void ConfigureModule(IServiceCollection services)
{
// 将HomeModel注册到CodeFirst将会在程序启动后自动创建表
CodeFirst.AddType(typeof(HomeModel));
// 注册服务、仓储、模型
var assembly = Assembly.GetAssembly(typeof(HomeService))!;
var types = assembly.GetTypes().ToList();
RegisterModule.RegisterAllService(types, services);
RegisterModule.RegisterAllRepo(types, services);
RegisterModule.RegisterAllModel(types, services);
// 添加控制器
services.AddControllers().AddApplicationPart(assembly);
Console.WriteLine("HomeModule ConfigureModule");
}
}