DevNet.Service 1.0.18

dotnet add package DevNet.Service --version 1.0.18
NuGet\Install-Package DevNet.Service -Version 1.0.18
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DevNet.Service" Version="1.0.18" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DevNet.Service --version 1.0.18
#r "nuget: DevNet.Service, 1.0.18"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DevNet.Service as a Cake Addin
#addin nuget:?package=DevNet.Service&version=1.0.18

// Install DevNet.Service as a Cake Tool
#tool nuget:?package=DevNet.Service&version=1.0.18

DevNet.Service

DevNet Service framework of AspNet.Core.

Simplify the complex Furion framework

Thanks

Thanks for Furion

version

1.0.16      发布

1.0.17      修改 AddFrameworkInject 名称为 AddServiceInject
            修改 UseFrameworkInject 名称为 UseServiceInject

1.0.18      修正敏感词替换异常问题

example

asp.net.Core Service framework

Run:

Program.cs:

// 默认启动
DevNet.Service.App.Run();

Startup:

public class ServiceStartup : AppStartup
{

    // 1. 创建 WebApplicationBuilder 之后,添加框架服务时最后调用
    public override void ServiceConfigure(IServiceCollection services) {

        services.AddControllersWithViews()

                // 注入框架相关服务
                .AddServiceInject()

                // 自定义扩展
                .AddServiceExtension()

                // 开启控制器 Autowired 注入
                .AddControllersAsServices()
                .AddAutowiredControllerActivator();
    }


    // 2. 添加框架服务后,Build()Application 前调用
    public override void WebBuilderConfigure(WebApplicationBuilder webApplicationBuilder) {
        //基类为空方法
        base.WebBuilderConfigure(webApplicationBuilder);
    }


    // 3. Application.Run 开始时 IStartupFilter 里调用
    public override void ApplicationConfigure(IApplicationBuilder app, IWebHostEnvironment env) {
        if (env.IsDevelopment()) {
            app.UseDeveloperExceptionPage();
        }

        //Use框架注入的服务
        app.UseServiceInject(useInjectOption => {
                                    useInjectOption.ForwardedHeadersOption =
                                        new ForwardedHeadersOptions {
                                                                        ForwardedHeaders =
                                                                            ForwardedHeaders.XForwardedFor
                                                                            | ForwardedHeaders.XForwardedProto
                                                                    };
                                    useInjectOption.UseKnifeUI = Convert.ToBoolean(App.Configuration["SpecificationDocument:EnableKnifeUI"]);
                                    useInjectOption.RoutePrefix = Convert.ToString(App.Configuration["SpecificationDocument:KnifeUIRoute"]);
                                });

        app.UseServiceExtension();

        app.UseEndpoints(
            endpoints => {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
    }
}

Services:

// 服务基类,直接用数据仓储基类
// need use DevNet ORM
// can use self ORM
public interface ISugarBaseService<T>
                : ISugarDataManager<T, IConditionBase>,
                  IAutowiredService,ITransient
                where T : EntityBase, new()
{
}

public class SugarBaseService<T> 
                : SugarDataManager<T, IConditionBase>,
                  ISugarBaseService<T>
                where T : EntityBase, new()
{

    bool IAutowiredService.HasAutowired
    {
        get; set;
    }

    ......Implement [IConditionBase] Base Method......
    
}

// 开启支持循环依赖,默认关闭
[SupportCircularDependency]     
public interface IRepositorySugarTestService 
                : ISugarBaseService<Tb_Test>
{
   
    bool TestMethod(string strtext);
}

[SupportCircularDependency]     
public class RepositorySugarTestService 
                : SugarBaseService<Tb_Test>, 
                  IRepositorySugarTestService
{

    public bool TestMethod(string strtext) {
        Console.WriteLine(strtext);
        return true;
    }
}

DynamicController:

public class BaseController : AutowiredService , IDynamicController {

}

[Route("api/test/")]
public class TestController : BaseController {

    [Autowired]
    IRepositorySugarTestService testService1 = null;

    // auto UnifyResult 
    // url: /api/test/testaction
    [HttpPost]
    public List<T> TestAction() {
        string ret = testServie1.TestMethod();
        ......

        retun new List<Tb_Test>();
    }    
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.18 92 4/28/2024
1.0.17 88 4/1/2024
1.0.16 87 3/30/2024
1.0.15 83 3/30/2024