13 Star 79 Fork 21

星尘 / DC.Framework

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

目前已起新的开发框架,有兴趣请移步。 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

About

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

Releases

No release

DC.Framework

Contributors

All

Activities

Load More
can not load any more
C#
1
https://gitee.com/xingchensoft/DC.Framework.git
git@gitee.com:xingchensoft/DC.Framework.git
xingchensoft
DC.Framework
DC.Framework
develop

Search

10d9f8b4 4838521 8bde8327 4838521