13 Star 80 Fork 21

星尘 / DC.Framework

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

目前已起新的开发框架,有兴趣请移步。 DH.FrameWork

本项目安装使用需要vs2019 preveiew最新版及最新版net core 3.0 sdk

请加群交流:774046050

目前本框架有借鉴参考如下项目:

Util

Bing.NetCore

NewLifeX

要看具体的使用方法:请看项目GitDC

我们已经有多个项目在使用此框架,模块邦为目前已上线项目。

常用方法:

截取字符串: StringExtensions文件中SubString方法

截取清空Html字符串:CutString方法

提取摘要方法:GetContentSummary()

获取全拼:WordsHelper.GetPinYin("")

获取简拼:WordsHelper.GetFirstPinYin("")

获取拼音首字母:WordsHelper.GetFirstPinYin(“”).Substring(0, 1)

生成0到9随机数:Randoms.RndNum(10)

生成时间随机文件名:Randoms.MakeFileRndName()

将1,2,3转为List的方法:Ding.Helpers.Convert.ToList(“”);

将List转为string的方法:ListExtensions 中JoinT 或者 Ding.Core中的StringHelp中的Join

将List转为string且带引号和逗号的方法:List.JoinT("'", ",");

判断字符串是否为空:UserName.IsNullOrEmpty()

转为GuId:Id.ToGuid()

转换对象:MapTo() MapToList() ToEntity() ToDto()

Json转字符串: .ToJson()

转为bool, .ToBoolean()

判断字符串是否在字符串中:ArrayExtensions.IsInArray

验证码: services.AddCaptchaService(o => { o.SecretKey = SiteSetting.Current.CaptchaSecretKey; }); services.AddTransient();

转为安全string: SafeString()

转为安全Object:SafeValue()

SqlQuery获取映射字段的方法
.Select(true)
.Select(t => t.GzryGzkh, "yhgh")
.Select(t => new Dictionary<object, string> { { t.Id, "wyhmxid" }, { t.WyhlbmxYhxm, "yhxm" } }) .Select(t => new object[] { t.CdMc, t.CdPx }, true)

SqlQuery设置Join的方法 .LeftJoin("sp").On<SysMenu, AuthPermissions>(x => x.Id, x => x.MenuId, Operator.Equal)

SqlQuery设置WhereIf方法 .WhereIf(x => x.ColumnId == parm.id, parm.id != 0) .WhereIf(x => x.Title.Contains(parm.key) || x.Tag.Contains(parm.key), !parm.key.IsNullOrEmpty()) .WhereIf(x => x.Audit, true, parm.audit == 0)

获取文件扩展名:FileHelper.GetFileExtension("文件名")

上传文件路径(根据文件类型分配路径):FileUtil.AssigendPath

如果文件夹不存在,则创建文件夹:DirectoryUtil.CreateIfNotExists("文件夹")

下载远程文件:FileHelper.DownLoadFileFromUrl(远程URL,物理路径)

判断文件或者文件夹是否存在: FileSystemObject.IsExist

获取枚举字段的注释:EnumHelper.GetDescription

获取枚举字段的所有字段注释: EnumHelper.GetDescriptions

获取针对wwwroot的物理路径:FileHelper.WebMapPath

获取针对根目录的物理路径:FileHelper.MapPath

返回相差的秒数:DateTimeUtil.StrDateDiffSeconds

返回相差的分钟:DateTimeUtil.StrDateDiffMinutes

返回相差的小时:DateTimeUtil.StrDateDiffHours

从指定字节数组创建图片: ImageUtil.FromBytes(byte[])

获取图片扩展名: ImageUtil.GetImageExtension(Image)

Mysql数据库备份:DbBackup.BackupDb(物理路径)

文件压缩:"被压缩文件物理路径".AsFile().Compress(“压缩文件物理路径”); //压缩文件

文件删除:FileHelper.DeleteFiles(物理路径, false);

文件夹删除:FileHelper.DeleteFiles(物理路径, true);

获取文件夹所有文件,返回为List<路径>:FileUtil.GetAllFiles(物理路径)

获取文件夹所有文件,返回为List<文件对象实体>:FileSystemObject.GetDirectoryAllInfos(物理路径, FsoMethod.File);

时间戳: DateTimeUtil.PHP_Time()

时间戳转普通时间:DateTimeUtil.PHPTOCTime(long)

获取当前站点Url: Web.GetSiteUrl() 返回:http(s)://www.baidu.com

获取Body内容:Web.Body和Web.GetBodyAsync

获取访问的上一页:Web.RefererUrl

MIT License Copyright (c) 2019 DingChuan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

是支持.net core 2.2 / .net core 3.0 的框架,旨在提升团队的开发输出能力,由常用公共操作类(工具类、帮助类)、分层架构基类,第三方组件封装,第三方业务接口封装等组成。 展开 收起
C# 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C#
1
https://gitee.com/xingchensoft/DC.Framework.git
git@gitee.com:xingchensoft/DC.Framework.git
xingchensoft
DC.Framework
DC.Framework
develop

搜索帮助

14c37bed 8189591 565d56ea 8189591