From 7a95ddc0398d6a7bab65b5b30cddaad56777f5ae Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Wed, 1 Jun 2022 18:49:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20IDummy=20=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/ServiceCollectionExtensions.cs | 12 ++++------ .../Services/DummyService.cs | 22 +++++++++++++++++++ .../client/BootstrapClient.Web.Core/IDummy.cs | 12 ++++++++++ 3 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 src/blazor/client/BootstrapClient.DataAccess/Services/DummyService.cs create mode 100644 src/blazor/client/BootstrapClient.Web.Core/IDummy.cs diff --git a/src/blazor/client/BootstrapClient.DataAccess/Extensions/ServiceCollectionExtensions.cs b/src/blazor/client/BootstrapClient.DataAccess/Extensions/ServiceCollectionExtensions.cs index a67b8ac3..dace5804 100644 --- a/src/blazor/client/BootstrapClient.DataAccess/Extensions/ServiceCollectionExtensions.cs +++ b/src/blazor/client/BootstrapClient.DataAccess/Extensions/ServiceCollectionExtensions.cs @@ -64,20 +64,16 @@ public static class ServiceCollectionExtensions return db; }); - //// 增加数据服务 - //services.AddSingleton(typeof(IDataService<>), typeof(DefaultDataService<>)); // 增加多数据库支持服务 services.AddSingleton(); - //// 增加业务服务 - //services.AddSingleton(); + // 增加业务服务 services.AddSingleton(); - //services.AddSingleton(); - //services.AddSingleton(); - //services.AddSingleton(); services.AddSingleton(); - //services.AddSingleton(); services.AddSingleton(); + + // 增加示例数据服务 + services.AddSingleton(); return services; } } diff --git a/src/blazor/client/BootstrapClient.DataAccess/Services/DummyService.cs b/src/blazor/client/BootstrapClient.DataAccess/Services/DummyService.cs new file mode 100644 index 00000000..8945ec87 --- /dev/null +++ b/src/blazor/client/BootstrapClient.DataAccess/Services/DummyService.cs @@ -0,0 +1,22 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information. +// Website: https://admin.blazor.zone + +using BootstrapClient.Web.Core; +using PetaPoco; + +namespace BootstrapClient.DataAccess.PetaPoco.Services; + +internal class DummyService : IDummy +{ + private IDatabase Database { get; } + + /// + /// + /// + /// + public DummyService(DBManagerService db) + { + Database = db.Create(); + } +} diff --git a/src/blazor/client/BootstrapClient.Web.Core/IDummy.cs b/src/blazor/client/BootstrapClient.Web.Core/IDummy.cs new file mode 100644 index 00000000..48fbc02e --- /dev/null +++ b/src/blazor/client/BootstrapClient.Web.Core/IDummy.cs @@ -0,0 +1,12 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information. +// Website: https://admin.blazor.zone + +namespace BootstrapClient.Web.Core; + +/// +/// 数据服务示例接口 +/// +public interface IDummy +{ +}