zoukankan      html  css  js  c++  java
  • ABP框架记录

    abp默认管理员:admin,密码:123qwe,这是写死的,xxx.CoreAuthorizationUsersUser.cs 行数:10
    1.先在Core项目中建立模型
    Models》Model.cs/ModelManager.cs

    2.在Application中建立接口和具体类:
    IModelAppService.cs
    ModelAppService.cs
    建立Dto和QueryInput类
    ModelDto/ModelQueryInput

    3.在EntityFramework的DbContext.cs类中,注册数据表,然后执行对应的migration命令更新数据库

    查看所有接口

    http://localhost:6234/api/AbpServiceProxies/GetAll?type=angular

    swagger:http://localhost:6234/apis/index

    多数据库:

    abp框架多数据库:
    A56.WMS.EntityFramework中:
    增加:对应的 DbContext.cs
    增加:对应的 /EntityFramework/Repositories/DbRepositoryBase.cs
    增加:对应的 Migrations文件夹,在文件夹里增加 Configuration.cs

    4.邮件发送:

    xxx.EntityFramework项目中:Migrations/SeedData/DefaultSettingsCreator.cs中配置邮件服务:

     public void Create()
            {
                #region Emailing
                string mail_smtp = ConfigurationManager.AppSettings["mail_smtp"];
                string mail_main = ConfigurationManager.AppSettings["mail_main"];
                string mail_pwd = ConfigurationManager.AppSettings["mail_pwd"];
                string mail_port = ConfigurationManager.AppSettings["mail_port"];
                string mail_ssl = ConfigurationManager.AppSettings["mail_ssl"];
                string mail_name = ConfigurationManager.AppSettings["mail_name"];
    
                AddSettingIfNotExists(EmailSettingNames.DefaultFromAddress, mail_main);
                AddSettingIfNotExists(EmailSettingNames.DefaultFromDisplayName, mail_name);
                AddSettingIfNotExists(EmailSettingNames.Smtp.Port, mail_port);
                AddSettingIfNotExists(EmailSettingNames.Smtp.Host, mail_smtp);
                AddSettingIfNotExists(EmailSettingNames.Smtp.UserName, mail_main);
                AddSettingIfNotExists(EmailSettingNames.Smtp.Password, mail_pwd);
                AddSettingIfNotExists(EmailSettingNames.Smtp.Domain, "");
                AddSettingIfNotExists(EmailSettingNames.Smtp.EnableSsl, mail_ssl);
                AddSettingIfNotExists(EmailSettingNames.Smtp.UseDefaultCredentials, "false");
                #endregion
    
                //Languages
                AddSettingIfNotExists(LocalizationSettingNames.DefaultLanguage, "en");
            }

    然后 程序包管理器控制台 执行:update-database

    nuget安装:AbpMailKit,然后在xxx.Core中找到 xxxCoreModule.cs

    [DependsOn(typeof(AbpMailKitModule))]    public class xxxCoreModule : AbpModule{}

    一切ok,然后就是调用了,注意调用发送邮件的时候如果是多租户的话,记得设置请求的Header信息》 Authorization bearer ticket

    public class TaskManager : IDomainService
        {
            private readonly IEmailSender _emailSender;
    
            public TaskManager(
            IEmailSender emailSender,
            ISmtpEmailSenderConfiguration smtpEmialSenderConfigtion
            )
            {
                _emailSender = emailSender;
            }
            /// <summary>
            /// 发送邮件
            /// </summary>
            /// <param name="emailAddress">目标邮箱</param>
            /// <param name="subject">邮件标题</param>
            /// <param name="body">邮件内容</param>
            public async void SendMail(string emailAddress, string subject, string body)
            {
                await _emailSender.SendAsync(
                    to: emailAddress,
                    subject: subject,
                    body: body,
                    isBodyHtml: true
                );
            }
        }

    https://www.cnblogs.com/LmuQuan/p/9122143.html

    http://www.cnblogs.com/farb/p/ModuleZeroContent.html

    http://www.cnblogs.com/farb/p/4849791.html

    http://www.cnblogs.com/farb/p/modulezeroInstall.html

    http://www.mamicode.com/info-detail-2320070.html

    http://www.bubuko.com/infodetail-2594809.html

    http://www.cnblogs.com/1zhk/p/5456389.html

    https://www.cnblogs.com/farb/p/moduleZeroUserManagement.html

    http://www.cnblogs.com/mienreal/p/4687789.html

    AbpSession管理:http://www.cnblogs.com/mienreal/p/4561235.html

    自定义过滤器:http://www.cnblogs.com/farb/p/ABPDataFilters.html

    邮件文件:http://zhaokuohaha.github.io/2016/09/06/abp%E9%82%AE%E4%BB%B6/

    https://www.cnblogs.com/Wddpct/p/5919507.html

    ABP框架使用Mysql:

    https://github.com/ABPFrameWorkGroup/AbpDocument2Chinese/blob/master/Markdown/Abp/9.4ABP%E5%9F%BA%E7%A1%80%E8%AE%BE%E6%96%BD%E5%B1%82-%E9%9B%86%E6%88%90EntityFrameworkMySql.md

    https://www.cnblogs.com/ixysy/p/6219719.html

    添加左侧菜单:https://blog.csdn.net/ysj1163620987/article/details/54909635
    ABP入门系列(16)——通过webapi与系统进行交互:https://www.jianshu.com/p/d14733432dc2
    ABP中文文档:https://github.com/ABPFrameWorkGroup/AbpDocument2Chinese/tree/master/Markdown
    ABP模板下载:https://aspnetboilerplate.com/Templates

  • 相关阅读:
    Python基础知识篇
    Django框架
    Django REST Framework框架
    NoSQL
    MySQL恩恩怨怨
    Python奇技淫巧
    一文搞定Flask
    数据结构与算法(Python)
    学习数据分析
    项目杂项
  • 原文地址:https://www.cnblogs.com/xsj1989/p/9408579.html
Copyright © 2011-2022 走看看