(相关资料图)
Known是基于C#和Blazor开发的前后端分离快速开发框架,开箱即用,跨平台,一处代码,多处运行。开源地址: https://gitee.com/known/Known
-- 安装模板dotnet new install KnownTemplate-- 创建项目dotnet new known --name=KIMS
说明:KIMS为测试项目名称
├─KIMS ->项目前后端共用库,客户端和实体类等。├─KIMS.Client ->Web前端,Blazor WebAssembly。├─KIMS.Core ->项目后端库,控制器、服务、数据访问等。├─KIMS.Razor ->项目前端库,模块页面和表单。├─KIMS.Server ->Web后端。├─KIMS.WinForm ->WinForm窗体及Razor页面。├─KIMSAlone ->桌面exe程序。├─KIMS.db ->默认SQLite数据库。├─KIMS.sln ->VS解决方案文件。
public class AppConfig{ public static void Initialize() { Config.AppId = "KIMS"; //系统ID,自动生成,默认项目名称 Config.AppName = "Known管理系统"; //在此配置你的系统名称 Config.SysVersion = "1.0.0"; //系统版本号 Config.AppAssembly = typeof(AppConfig).Assembly; //实体模型程序集,用于模块管理配置列表字段 PagingCriteria.DefaultPageSize = 20; //默认分页大小 DicCategory.AddCategories(); //自动加载数据字典类别,在AppDictionary中增加类别 Cache.AttachCodes(typeof(AppConfig).Assembly); //自动加载CodeTable特性类常量进入缓存 //在此配置你的系统其他全局配置 }}
-- SQLite -- Access -- MySQL
-- 打开项目下 AppServer.cs 文件修改数据库连接,示例代码如下:
class AppServer{ internal static void Initialize(WebApplicationBuilder builder) { //配置环境目录 KCConfig.WebRoot = builder.Environment.WebRootPath; KCConfig.ContentRoot = builder.Environment.ContentRootPath; //读取appsettings.json配置 var configuration = builder.Configuration; var dbFile = configuration.GetSection("DBFile").Get();//数据库配置 var uploadPath = configuration.GetSection("UploadPath").Get();//上传文件存储路径 Initialize(dbFile, uploadPath); } internal static void Initialize(string? dbFile, string? uploadPath) { //初始化配置 AppConfig.Initialize(); AppCore.Initialize(); //转换绝对路径 var path = KCConfig.ContentRoot; dbFile = Path.GetFullPath(Path.Combine(path, dbFile)); uploadPath = Path.GetFullPath(Path.Combine(path, uploadPath)); //注册数据访问提供者和初始化数据库连接 Database.RegisterProviders(new Dictionary { ["SQLite"] = typeof(Microsoft.Data.Sqlite.SqliteFactory) }); var connInfo = new Known.Core.ConnectionInfo { Name = "Default", ProviderName = "SQLite", ConnectionString = $"Data Source={dbFile};" }; KCConfig.App = new AppInfo { Connections = new List { connInfo }, UploadPath = uploadPath }; }}
X 关闭
2023-05-19 15:14:15
2023-05-19 14:54:07
2023-05-19 14:13:34
2023-05-19 13:14:14
2023-05-19 12:42:20
2023-05-19 11:56:30
2023-05-19 11:30:08
2023-05-19 11:13:51
2023-05-19 10:37:35
2023-05-19 10:05:48
2023-05-19 09:57:12
2023-05-19 09:21:46
2023-05-19 08:55:07
2023-05-19 08:01:38
2023-05-19 06:58:22
2023-05-19 06:03:08
2023-05-19 04:55:24
2023-05-19 01:53:17
2023-05-18 23:12:17
2023-05-18 22:12:23
2023-05-18 21:38:42
2023-05-18 20:51:03
2023-05-18 19:57:19
2023-05-18 19:02:57
2023-05-18 18:25:44
2023-05-18 17:54:46
2023-05-18 17:32:02
2023-05-18 17:04:44
2023-05-18 16:36:13
2023-05-18 16:01:22
2023-05-18 15:14:12
2023-05-18 14:42:11
2023-05-18 14:05:28
2023-05-18 13:38:09
2023-05-18 12:58:01
2023-05-18 12:19:30
2023-05-18 11:30:32
2023-05-18 11:08:44
2023-05-18 10:46:56
2023-05-18 10:08:07
2023-05-18 09:57:38
2023-05-18 09:22:37
2023-05-18 08:44:04
2023-05-18 07:55:27
2023-05-18 07:13:33
2023-05-18 06:09:38
2023-05-18 05:10:00
2023-05-18 02:19:18
2023-05-17 23:20:46
2023-05-17 22:19:10
2023-05-17 21:01:59
2023-05-17 21:01:25
2023-05-17 20:01:30
2023-05-17 19:28:01
2023-05-17 18:45:53
2023-05-17 18:01:21
2023-05-17 17:50:17
2023-05-17 17:04:44
2023-05-17 16:43:46
2023-05-17 16:01:12
2023-05-17 15:40:14
2023-05-17 15:01:54
2023-05-17 14:23:09
2023-05-17 13:21:58
2023-05-17 12:46:29
2023-05-17 11:49:41
2023-05-17 11:35:32
2023-05-17 11:01:39
2023-05-17 10:28:19
2023-05-17 10:03:11
2023-05-17 09:34:55
2023-05-17 09:15:42
2023-05-17 08:22:21
2023-05-17 07:45:32
2023-05-17 06:49:07
2023-05-17 05:48:20
2023-05-17 04:13:54
2023-05-17 01:05:38
2023-05-16 23:02:32
2023-05-16 22:01:43
2023-05-16 21:11:44
2023-05-16 20:05:06
2023-05-16 19:25:02
2023-05-16 18:50:09
2023-05-16 18:13:05
2023-05-16 17:50:15
2023-05-16 17:16:45
2023-05-16 16:33:37
2023-05-16 16:14:52
2023-05-16 15:31:57
2023-05-16 15:01:23
2023-05-16 14:38:51
2023-05-16 14:06:23
2023-05-16 13:07:33
2023-05-16 12:24:10
2023-05-16 11:53:43
2023-05-16 11:13:45
2023-05-16 10:44:20
2023-05-16 10:35:18
2023-05-16 09:52:33
Copyright © 2015-2022 化工头条网版权所有 备案号:沪ICP备2022005074号-20 联系邮箱:58 55 97 3@qq.com