Browse Source

Merge pull request #605 from colinin/notification-template

Notification template
pull/645/head
yx lin 4 years ago
committed by GitHub
parent
commit
8c5b661cfe
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 64
      aspnet-core/LINGYUN.MicroService.All.sln
  2. 12
      aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN.Abp.ExceptionHandling.Notifications.csproj
  3. 37
      aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationDefinitionProvider.cs
  4. 8
      aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationNames.cs
  5. 21
      aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionHandlingModule.cs
  6. 30
      aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionSubscriber.cs
  7. 7
      aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/en.json
  8. 7
      aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/zh-Hans.json
  9. 0
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/FodyWeavers.xml
  10. 30
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/FodyWeavers.xsd
  11. 31
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN.Abp.Notifications.Common.csproj
  12. 26
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/AbpNotificationsCommonModule.cs
  13. 23
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Emailing/NotificationsCommonTemplateProvider.cs
  14. 11
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Localization/Common/en.json
  15. 11
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Localization/Common/zh-Hans.json
  16. 82
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/NotificationsCommonNotificationDefinitionProvider.cs
  17. 11
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/NotificationsCommonNotificationNames.cs
  18. 0
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/Volo/Abp/MultiTenancy/TenantNotificationNames.cs
  19. 0
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/Volo/Abp/Users/UserNotificationNames.cs
  20. 47
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs
  21. 12
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN/Abp/Notifications/TextTemplating/AbpNotificationsTextTemplatingModule.cs
  22. 16
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN/Abp/Notifications/TextTemplating/NotificationTemplateContentContributor.cs
  23. 41
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN.Abp.Notifications.csproj
  24. 12
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs
  25. 23
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationTemplateDefinitionProvider.cs
  26. 9
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationTemplateStore.cs
  27. 14
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/en.json
  28. 14
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/zh-Hans.json
  29. 45
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinition.cs
  30. 6
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationTemplate.cs
  31. 16
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationTemplateStore.cs
  32. 5
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationSendDto.cs
  33. 10
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationTemplateDto.cs
  34. 5
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/INotificationAppService.cs
  35. 16
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/MyNotificationAppService.cs
  36. 65
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/NotificationAppService.cs
  37. 17
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/en.json
  38. 18
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json
  39. 4
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/MessageServiceErrorCodes.cs
  40. 14
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Notifications/NotificationTemplateConsts.cs
  41. 19
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs
  42. 36
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/AbpMessageServiceNotificationDefinitionProvider.cs
  43. 11
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationTemplate.cs
  44. 1
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/AbpMessageServiceEntityFrameworkCoreModule.cs
  45. 14
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Notifications/NotificationController.cs
  46. 3
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/FodyWeavers.xml
  47. 30
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/FodyWeavers.xsd
  48. 24
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN.Abp.TextTemplating.Application.Contracts.csproj
  49. 14
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationContractsModule.cs
  50. 8
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/AbpTextTemplatingRemoteServiceConsts.cs
  51. 16
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/ITextTemplateAppService.cs
  52. 23
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/Permissions/AbpTextTemplatingPermissionDefinitionProvider.cs
  53. 21
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/Permissions/AbpTextTemplatingPermissions.cs
  54. 9
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateDto.cs
  55. 14
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateGetInput.cs
  56. 19
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateUpdateInput.cs
  57. 3
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/FodyWeavers.xml
  58. 30
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/FodyWeavers.xsd
  59. 21
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN.Abp.TextTemplating.Application.csproj
  60. 13
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingAppServiceBase.cs
  61. 11
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationAutoMapperProfile.cs
  62. 23
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationModule.cs
  63. 135
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/TextTemplateAppService.cs
  64. 3
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/FodyWeavers.xml
  65. 30
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/FodyWeavers.xsd
  66. 20
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN.Abp.TextTemplating.Domain.Shared.csproj
  67. 33
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainSharedModule.cs
  68. 11
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/AbpTextTemplatingErrorCodes.cs
  69. 8
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/AbpTextTemplatingResource.cs
  70. 5
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/en.json
  71. 5
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/zh-Hans.json
  72. 12
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateConsts.cs
  73. 3
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/FodyWeavers.xml
  74. 30
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/FodyWeavers.xsd
  75. 4
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj
  76. 12
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbProperties.cs
  77. 12
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs
  78. 11
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/ITextTemplateRepository.cs
  79. 34
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplate.cs
  80. 17
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentContributor.cs
  81. 3
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/FodyWeavers.xml
  82. 30
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/FodyWeavers.xsd
  83. 19
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj
  84. 45
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbContextModelCreatingExtensions.cs
  85. 21
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingEntityFrameworkCoreModule.cs
  86. 31
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/EfCoreTextTemplateRepository.cs
  87. 13
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/ITextTemplatingDbContext.cs
  88. 25
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/TextTemplatingDbContext.cs
  89. 5
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/TextTemplatingEfCoreQueryableExtensions.cs
  90. 3
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/FodyWeavers.xml
  91. 30
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/FodyWeavers.xsd
  92. 19
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/LINGYUN.Abp.TextTemplating.HttpApi.Client.csproj
  93. 19
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/LINGYUN/Abp/TextTemplating/AbpTextTemplatingHttpApiClientModule.cs
  94. 3
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/FodyWeavers.xml
  95. 30
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/FodyWeavers.xsd
  96. 19
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN.Abp.TextTemplating.HttpApi.csproj
  97. 12
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/AbpTextTemplatingControllerBase.cs
  98. 40
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/AbpTextTemplatingHttpApiModule.cs
  99. 53
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/TextTemplateController.cs
  100. 5
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.Configure.cs

64
aspnet-core/LINGYUN.MicroService.All.sln

@ -408,7 +408,23 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Platform.Theme.VueV
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Platform.Settings.VueVbenAdmin", "modules\platform\LINGYUN.Platform.Settings.VueVbenAdmin\LINGYUN.Platform.Settings.VueVbenAdmin.csproj", "{8DF55DAB-4C1D-46F7-9324-0050F47B3BED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.TextTemplating", "modules\common\LINGYUN.Abp.Notifications.TextTemplating\LINGYUN.Abp.Notifications.TextTemplating.csproj", "{06FF5EFA-DEDA-4E12-A482-8FCE4077F68A}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "text-templating", "text-templating", "{ABD89F39-62D9-439E-8662-BE4F36BFA04F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.Domain.Shared", "modules\text-templating\LINGYUN.Abp.TextTemplating.Domain.Shared\LINGYUN.Abp.TextTemplating.Domain.Shared.csproj", "{D4B4800F-6238-4EA9-A9BB-298D668C26C4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.Domain", "modules\text-templating\LINGYUN.Abp.TextTemplating.Domain\LINGYUN.Abp.TextTemplating.Domain.csproj", "{F9AC4123-7987-47D3-85D6-CD13928F3683}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.Application.Contracts", "modules\text-templating\LINGYUN.Abp.TextTemplating.Application.Contracts\LINGYUN.Abp.TextTemplating.Application.Contracts.csproj", "{22BDDF5C-F911-4978-B83F-981F3652BF45}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.Application", "modules\text-templating\LINGYUN.Abp.TextTemplating.Application\LINGYUN.Abp.TextTemplating.Application.csproj", "{0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.HttpApi", "modules\text-templating\LINGYUN.Abp.TextTemplating.HttpApi\LINGYUN.Abp.TextTemplating.HttpApi.csproj", "{4711320B-F98D-4CB0-BFEB-B9685B6CBCB7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.EntityFrameworkCore", "modules\text-templating\LINGYUN.Abp.TextTemplating.EntityFrameworkCore\LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj", "{130F8ED1-A64F-48DE-BF43-18EAD19CAF63}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.HttpApi.Client", "modules\text-templating\LINGYUN.Abp.TextTemplating.HttpApi.Client\LINGYUN.Abp.TextTemplating.HttpApi.Client.csproj", "{A53FE09E-6B1C-46C0-9422-C313D14AE9E4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.Common", "modules\common\LINGYUN.Abp.Notifications.Common\LINGYUN.Abp.Notifications.Common.csproj", "{0CE035CF-2D8A-4559-93EC-ADBEC4237C61}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -1056,10 +1072,38 @@ Global
{8DF55DAB-4C1D-46F7-9324-0050F47B3BED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8DF55DAB-4C1D-46F7-9324-0050F47B3BED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8DF55DAB-4C1D-46F7-9324-0050F47B3BED}.Release|Any CPU.Build.0 = Release|Any CPU
{06FF5EFA-DEDA-4E12-A482-8FCE4077F68A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{06FF5EFA-DEDA-4E12-A482-8FCE4077F68A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{06FF5EFA-DEDA-4E12-A482-8FCE4077F68A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{06FF5EFA-DEDA-4E12-A482-8FCE4077F68A}.Release|Any CPU.Build.0 = Release|Any CPU
{D4B4800F-6238-4EA9-A9BB-298D668C26C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4B4800F-6238-4EA9-A9BB-298D668C26C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4B4800F-6238-4EA9-A9BB-298D668C26C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4B4800F-6238-4EA9-A9BB-298D668C26C4}.Release|Any CPU.Build.0 = Release|Any CPU
{F9AC4123-7987-47D3-85D6-CD13928F3683}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9AC4123-7987-47D3-85D6-CD13928F3683}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9AC4123-7987-47D3-85D6-CD13928F3683}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9AC4123-7987-47D3-85D6-CD13928F3683}.Release|Any CPU.Build.0 = Release|Any CPU
{22BDDF5C-F911-4978-B83F-981F3652BF45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22BDDF5C-F911-4978-B83F-981F3652BF45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22BDDF5C-F911-4978-B83F-981F3652BF45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22BDDF5C-F911-4978-B83F-981F3652BF45}.Release|Any CPU.Build.0 = Release|Any CPU
{0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0}.Release|Any CPU.Build.0 = Release|Any CPU
{4711320B-F98D-4CB0-BFEB-B9685B6CBCB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4711320B-F98D-4CB0-BFEB-B9685B6CBCB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4711320B-F98D-4CB0-BFEB-B9685B6CBCB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4711320B-F98D-4CB0-BFEB-B9685B6CBCB7}.Release|Any CPU.Build.0 = Release|Any CPU
{130F8ED1-A64F-48DE-BF43-18EAD19CAF63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{130F8ED1-A64F-48DE-BF43-18EAD19CAF63}.Debug|Any CPU.Build.0 = Debug|Any CPU
{130F8ED1-A64F-48DE-BF43-18EAD19CAF63}.Release|Any CPU.ActiveCfg = Release|Any CPU
{130F8ED1-A64F-48DE-BF43-18EAD19CAF63}.Release|Any CPU.Build.0 = Release|Any CPU
{A53FE09E-6B1C-46C0-9422-C313D14AE9E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A53FE09E-6B1C-46C0-9422-C313D14AE9E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A53FE09E-6B1C-46C0-9422-C313D14AE9E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A53FE09E-6B1C-46C0-9422-C313D14AE9E4}.Release|Any CPU.Build.0 = Release|Any CPU
{0CE035CF-2D8A-4559-93EC-ADBEC4237C61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0CE035CF-2D8A-4559-93EC-ADBEC4237C61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CE035CF-2D8A-4559-93EC-ADBEC4237C61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CE035CF-2D8A-4559-93EC-ADBEC4237C61}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1259,7 +1303,15 @@ Global
{88502844-D83C-4541-96AC-A8291E261F63} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E}
{67DC7FA0-506A-4977-95F6-BC739B2BC4BA} = {F4923692-D343-4318-AECA-96F580B1A563}
{8DF55DAB-4C1D-46F7-9324-0050F47B3BED} = {F4923692-D343-4318-AECA-96F580B1A563}
{06FF5EFA-DEDA-4E12-A482-8FCE4077F68A} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E}
{ABD89F39-62D9-439E-8662-BE4F36BFA04F} = {C5CAD011-DF84-4914-939C-0C029DCEF26F}
{D4B4800F-6238-4EA9-A9BB-298D668C26C4} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F}
{F9AC4123-7987-47D3-85D6-CD13928F3683} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F}
{22BDDF5C-F911-4978-B83F-981F3652BF45} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F}
{0C824BB4-81FC-4B28-B7B1-07B2B2BB70A0} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F}
{4711320B-F98D-4CB0-BFEB-B9685B6CBCB7} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F}
{130F8ED1-A64F-48DE-BF43-18EAD19CAF63} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F}
{A53FE09E-6B1C-46C0-9422-C313D14AE9E4} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F}
{0CE035CF-2D8A-4559-93EC-ADBEC4237C61} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}

12
aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN.Abp.ExceptionHandling.Notifications.csproj

@ -8,16 +8,6 @@
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<None Remove="LINGYUN\Abp\ExceptionHandling\Notifications\Localization\Resources\en.json" />
<None Remove="LINGYUN\Abp\ExceptionHandling\Notifications\Localization\Resources\zh-Hans.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LINGYUN\Abp\ExceptionHandling\Notifications\Localization\Resources\en.json" />
<EmbeddedResource Include="LINGYUN\Abp\ExceptionHandling\Notifications\Localization\Resources\zh-Hans.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Localization" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
@ -25,7 +15,7 @@
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.ExceptionHandling\LINGYUN.Abp.ExceptionHandling.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Notifications\LINGYUN.Abp.Notifications.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Notifications.Common\LINGYUN.Abp.Notifications.Common.csproj" />
</ItemGroup>
</Project>

37
aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationDefinitionProvider.cs

@ -1,37 +0,0 @@
using LINGYUN.Abp.ExceptionHandling.Localization;
using LINGYUN.Abp.Notifications;
using Volo.Abp.Localization;
namespace LINGYUN.Abp.ExceptionHandling.Notifications
{
public class AbpExceptionHandlingNotificationDefinitionProvider : NotificationDefinitionProvider
{
public override void Define(INotificationDefinitionContext context)
{
var exceptionGroup = context.AddGroup(
AbpExceptionHandlingNotificationNames.GroupName,
L("Notifications:Exception"),
false);
exceptionGroup.AddNotification(
name: AbpExceptionHandlingNotificationNames.NotificationName,
displayName: L("Notifications:ExceptionNotifier"),
description: L("Notifications:ExceptionNotifier"),
notificationType: NotificationType.System,
lifetime: NotificationLifetime.Persistent,
allowSubscriptionToClients: false)
// 指定通知提供程序
.WithProviders(
NotificationProviderNames.SignalR,
NotificationProviderNames.Emailing)
// 特定的通知提供程序属性
// 此处为邮件通知定义的模板名称
.WithProperty("Template", "ExceptionNotifier");
}
protected LocalizableString L(string name)
{
return LocalizableString.Create<ExceptionHandlingResource>(name);
}
}
}

8
aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpExceptionHandlingNotificationNames.cs

@ -1,8 +0,0 @@
namespace LINGYUN.Abp.ExceptionHandling.Notifications
{
public class AbpExceptionHandlingNotificationNames
{
public const string GroupName = "LINGYUN.Abp.ExceptionHandling";
public const string NotificationName = GroupName + ".Notifier";
}
}

21
aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionHandlingModule.cs

@ -1,29 +1,12 @@
using LINGYUN.Abp.ExceptionHandling.Localization;
using LINGYUN.Abp.Notifications;
using Volo.Abp.Localization;
using LINGYUN.Abp.Notifications.Common;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Abp.ExceptionHandling.Notifications
{
[DependsOn(
typeof(AbpExceptionHandlingModule),
typeof(AbpNotificationModule))]
typeof(AbpNotificationsCommonModule))]
public class AbpNotificationsExceptionHandlingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpNotificationsExceptionHandlingModule>();
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Get<ExceptionHandlingResource>()
.AddVirtualJson("/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources");
});
}
}
}

30
aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/AbpNotificationsExceptionSubscriber.cs

@ -2,6 +2,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.MultiTenancy;
@ -22,24 +23,21 @@ namespace LINGYUN.Abp.ExceptionHandling.Notifications
protected override async Task SendErrorNotifierAsync(ExceptionSendNotifierContext context)
{
var notificationSender = context.ServiceProvider.GetRequiredService<INotificationSender>();
NotificationData notificationData = new NotificationData();
// 写入通知数据
notificationData.TrySetData("header", "An application exception has occurred");
notificationData.TrySetData("footer", $"Copyright to LY Colin © {DateTime.Now.Year}");
notificationData.TrySetData("loglevel", context.LogLevel.ToString());
notificationData.TrySetData("stacktrace", context.Exception.ToString());
notificationData.WriteStandardData(
context.Exception.GetType().FullName,
context.Exception.Message,
DateTime.Now,
"System");
// 发送错误模板消息
await notificationSender.SendNofiterAsync(
AbpExceptionHandlingNotificationNames.NotificationName,
notificationData,
NotificationsCommonNotificationNames.ExceptionHandling,
new NotificationTemplate(
NotificationsCommonNotificationNames.ExceptionHandling,
formUser: "System",
data: new Dictionary<string, object>
{
{ "header", "An application exception has occurred" },
{ "footer", $"Copyright to LY Colin © {DateTime.Now.Year}" },
{ "loglevel", context.LogLevel.ToString() },
{ "stackTrace", context.Exception.ToString() },
}),
user: null,
CurrentTenant.Id,
CurrentTenant.Id,
NotificationSeverity.Error);
}
}

7
aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/en.json

@ -1,7 +0,0 @@
{
"culture": "en",
"texts": {
"Notifications:Exception": "Exception",
"Notifications:ExceptionNotifier": "Exception Notifier"
}
}

7
aspnet-core/modules/common/LINGYUN.Abp.ExceptionHandling.Notifications/LINGYUN/Abp/ExceptionHandling/Notifications/Localization/Resources/zh-Hans.json

@ -1,7 +0,0 @@
{
"culture": "zh-Hans",
"texts": {
"Notifications:Exception": "异常通知",
"Notifications:ExceptionNotifier": "异常推送"
}
}

0
aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/FodyWeavers.xml → aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/FodyWeavers.xml

30
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

31
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN.Abp.Notifications.Common.csproj

@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<None Remove="LINGYUN\Abp\Notifications\Emailing\Templates\ExceptionNotifier\*.tpl" />
<None Remove="LINGYUN\Abp\Notifications\Emailing\Templates\layout.tpl" />
<None Remove="LINGYUN\Abp\Notifications\Emailing\Templates\NewTenantRegisterd\*.tpl" />
<None Remove="LINGYUN\Abp\Notifications\Emailing\Templates\WelcomeToApplication\*.tpl" />
<None Remove="LINGYUN\Abp\Notifications\Localization\Common\*.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LINGYUN\Abp\Notifications\Emailing\Templates\ExceptionNotifier\*.tpl" />
<EmbeddedResource Include="LINGYUN\Abp\Notifications\Emailing\Templates\layout.tpl" />
<EmbeddedResource Include="LINGYUN\Abp\Notifications\Emailing\Templates\NewTenantRegisterd\*.tpl" />
<EmbeddedResource Include="LINGYUN\Abp\Notifications\Emailing\Templates\WelcomeToApplication\*.tpl" />
<EmbeddedResource Include="LINGYUN\Abp\Notifications\Localization\Common\*.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.Notifications\LINGYUN.Abp.Notifications.csproj" />
</ItemGroup>
</Project>

26
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/AbpNotificationsCommonModule.cs

@ -0,0 +1,26 @@
using LINGYUN.Abp.Notifications.Localization;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Abp.Notifications.Common;
[DependsOn(
typeof(AbpNotificationModule))]
public class AbpNotificationsCommonModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpNotificationsCommonModule>();
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Get<NotificationsResource>()
.AddVirtualJson("/LINGYUN/Abp/Notifications/Localization/Common");
});
}
}

23
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Emailing/NotificationsCommonTemplateProvider.cs

@ -0,0 +1,23 @@
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.Notifications;
public class NotificationsCommonTemplateProvider : TemplateDefinitionProvider
{
public override void Define(ITemplateDefinitionContext context)
{
context.Add(CreateEmailTemplate());
}
protected virtual TemplateDefinition[] CreateEmailTemplate()
{
return new TemplateDefinition[]
{
new TemplateDefinition(
name: "EmailNotifierLayout",
defaultCultureName: "en",
isLayout: true)
.WithVirtualFilePath( "/LINGYUN/Abp/Notifications/Emailing/Templates/layout.tpl", isInlineLocalized: true)
};
}
}

11
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Localization/Common/en.json

@ -0,0 +1,11 @@
{
"culture": "en",
"texts": {
"Notifications:MultiTenancy": "Multi Tenancy",
"Notifications:Users": "Users",
"Notifications:NewTenantRegisterd": "Tenant creation notification",
"Notifications:WelcomeToApplication": "User Welcome Notice",
"Notifications:Primitives": "Primitives",
"Notifications:ExceptionNotifier": "Exception Notifier"
}
}

11
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/Localization/Common/zh-Hans.json

@ -0,0 +1,11 @@
{
"culture": "zh-Hans",
"texts": {
"Notifications:MultiTenancy": "租户通知",
"Notifications:Users": "用户通知",
"Notifications:NewTenantRegisterd": "租户创建通知",
"Notifications:WelcomeToApplication": "用户欢迎通知",
"Notifications:Primitives": "标准通知",
"Notifications:ExceptionNotifier": "异常通知推送"
}
}

82
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/NotificationsCommonNotificationDefinitionProvider.cs

@ -0,0 +1,82 @@
using LINGYUN.Abp.Notifications.Localization;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;
using Volo.Abp.TextTemplating;
using Volo.Abp.Users;
namespace LINGYUN.Abp.Notifications;
public class NotificationsCommonNotificationDefinitionProvider : NotificationDefinitionProvider
{
public override void Define(INotificationDefinitionContext context)
{
var commonGroup = context.AddGroup(
NotificationsCommonNotificationNames.GroupName,
L("Notifications:Primitives"),
false);
commonGroup.AddNotification(
name: NotificationsCommonNotificationNames.ExceptionHandling,
displayName: L("Notifications:ExceptionNotifier"),
description: L("Notifications:ExceptionNotifier"),
notificationType: NotificationType.System,
lifetime: NotificationLifetime.Persistent,
allowSubscriptionToClients: false)
// 指定通知提供程序
.WithProviders(
NotificationProviderNames.SignalR,
NotificationProviderNames.Emailing)
// 设定为模板通知
.WithTemplate(typeof(NotificationsResource), layout: "EmailNotifierLayout")
.WithTemplate(template =>
{
template.WithVirtualFilePath("/LINGYUN/Abp/Notifications/Emailing/Templates/ExceptionNotifier", isInlineLocalized: false);
});
var tenantsGroup = context.AddGroup(
TenantNotificationNames.GroupName,
L("Notifications:MultiTenancy"),
false);
tenantsGroup.AddNotification(
TenantNotificationNames.NewTenantRegistered,
L("Notifications:NewTenantRegisterd"),
L("Notifications:NewTenantRegisterd"),
notificationType: NotificationType.System,
lifetime: NotificationLifetime.OnlyOne,
allowSubscriptionToClients: false
)
.WithProviders(
NotificationProviderNames.SignalR,
NotificationProviderNames.Emailing)
.WithTemplate(typeof(NotificationsResource), layout: "EmailNotifierLayout")
.WithTemplate(template =>
{
template.WithVirtualFilePath("/LINGYUN/Abp/Notifications/Emailing/Templates/NewTenantRegisterd", isInlineLocalized: false);
});
var usersGroup = context.AddGroup(
UserNotificationNames.GroupName,
L("Notifications:Users"));
usersGroup.AddNotification(
UserNotificationNames.WelcomeToApplication,
L("Notifications:WelcomeToApplication"),
L("Notifications:WelcomeToApplication"),
notificationType: NotificationType.System,
lifetime: NotificationLifetime.OnlyOne,
allowSubscriptionToClients: true)
.WithProviders(
NotificationProviderNames.SignalR,
NotificationProviderNames.Emailing)
.WithTemplate(typeof(NotificationsResource), layout: "EmailNotifierLayout")
.WithTemplate(template =>
{
template.WithVirtualFilePath("/LINGYUN/Abp/Notifications/Emailing/Templates/WelcomeToApplication", isInlineLocalized: false);
});
}
protected LocalizableString L(string name)
{
return LocalizableString.Create<NotificationsResource>(name);
}
}

11
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/LINGYUN/Abp/Notifications/NotificationsCommonNotificationNames.cs

@ -0,0 +1,11 @@
namespace LINGYUN.Abp.Notifications
{
public class NotificationsCommonNotificationNames
{
public const string GroupName = "LINGYUN.Abp.Notifications.Primitives";
/// <summary>
/// 异常处理
/// </summary>
public const string ExceptionHandling = GroupName + ".ExceptionHandling";
}
}

0
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/Volo/Abp/MultiTenancy/TenantNotificationNames.cs → aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/Volo/Abp/MultiTenancy/TenantNotificationNames.cs

0
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/Volo/Abp/Users/UserNotificationNames.cs → aspnet-core/modules/common/LINGYUN.Abp.Notifications.Common/Volo/Abp/Users/UserNotificationNames.cs

47
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs

@ -1,12 +1,15 @@
using LINGYUN.Abp.Identity;
using LINGYUN.Abp.RealTime.Localization;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Emailing;
using Volo.Abp.Localization;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.Notifications.Emailing;
@ -17,28 +20,26 @@ public class EmailingNotificationPublishProvider : NotificationPublishProvider
public override string Name => ProviderName;
protected IEmailSender EmailSender { get; }
protected AbpLocalizationOptions LocalizationOptions { get; }
protected ITemplateRenderer TemplateRenderer { get; }
protected IEmailSender EmailSender { get; }
protected IStringLocalizerFactory LocalizerFactory { get; }
protected IIdentityUserRepository UserRepository { get; }
protected INotificationDefinitionManager NotificationDefinitionManager { get; }
public EmailingNotificationPublishProvider(
IEmailSender emailSender,
ITemplateRenderer templateRenderer,
IStringLocalizerFactory localizerFactory,
IIdentityUserRepository userRepository,
INotificationDefinitionManager notificationDefinitionManager)
IOptions<AbpLocalizationOptions> localizationOptions)
{
EmailSender = emailSender;
TemplateRenderer = templateRenderer;
LocalizerFactory = localizerFactory;
UserRepository = userRepository;
NotificationDefinitionManager = notificationDefinitionManager;
LocalizationOptions = localizationOptions.Value;
}
protected async override Task PublishAsync(
@ -56,20 +57,30 @@ public class EmailingNotificationPublishProvider : NotificationPublishProvider
return;
}
var notificationDefinition = NotificationDefinitionManager.Get(notification.Name);
var notificationDisplayName = notificationDefinition.DisplayName.Localize(LocalizerFactory).Value;
notificationDefinition.Properties.TryGetValue("Template", out var template);
if (template == null)
if (!notification.Data.NeedLocalizer())
{
Logger.LogWarning("The email template is not specified, so the email notification cannot be sent!");
return;
var title = notification.Data.TryGetData("title").ToString();
var message = notification.Data.TryGetData("message").ToString();
await EmailSender.SendAsync(emailAddress, title, message);
}
else
{
var titleInfo = notification.Data.TryGetData("title").As<LocalizableStringInfo>();
var titleResource = GetResource(titleInfo.ResourceName);
var title = LocalizerFactory.Create(titleResource.ResourceType)[titleInfo.Name, titleInfo.Values].Value;
var messageInfo = notification.Data.TryGetData("message").As<LocalizableStringInfo>();
var messageResource = GetResource(messageInfo.ResourceName);
var message = LocalizerFactory.Create(messageResource.ResourceType)[messageInfo.Name, messageInfo.Values].Value;
var content = await TemplateRenderer.RenderAsync(
template.ToString(),
globalContext: notification.Data.ExtraProperties);
await EmailSender.SendAsync(emailAddress, title, message);
}
}
await EmailSender.SendAsync(emailAddress, notificationDisplayName, content);
private LocalizationResource GetResource(string resourceName)
{
return LocalizationOptions.Resources.Values
.First(x => x.ResourceName.Equals(resourceName));
}
}

12
aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN/Abp/Notifications/TextTemplating/AbpNotificationsTextTemplatingModule.cs

@ -1,12 +0,0 @@
using Volo.Abp.Modularity;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.Notifications.TextTemplating;
[DependsOn(
typeof(AbpNotificationModule),
typeof(AbpTextTemplatingCoreModule))]
public class AbpNotificationsTextTemplatingModule : AbpModule
{
}

16
aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN/Abp/Notifications/TextTemplating/NotificationTemplateContentContributor.cs

@ -1,16 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.Notifications.TextTemplating;
public class NotificationTemplateContentContributor : ITemplateContentContributor, ITransientDependency
{
public async virtual Task<string> GetOrNullAsync(TemplateContentContributorContext context)
{
var store = context.ServiceProvider.GetRequiredService<INotificationTemplateStore>();
return await store.GetOrNullAsync(context.TemplateDefinition.Name, context.Culture);
}
}

41
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN.Abp.Notifications.csproj

@ -1,30 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<None Remove="LINGYUN\Abp\Notifications\Localization\Resources\*.json" />
</ItemGroup>
<ItemGroup>
<None Remove="LINGYUN\Abp\Notifications\Localization\Resources\*.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LINGYUN\Abp\Notifications\Localization\Resources\*.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LINGYUN\Abp\Notifications\Localization\Resources\*.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.EventBus" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Json" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Abstractions" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.EventBus" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Json" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Abstractions" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.TextTemplating.Core" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.IdGenerator\LINGYUN.Abp.IdGenerator.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.RealTime\LINGYUN.Abp.RealTime.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.IdGenerator\LINGYUN.Abp.IdGenerator.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.RealTime\LINGYUN.Abp.RealTime.csproj" />
</ItemGroup>
</Project>

12
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs

@ -10,6 +10,7 @@ using Volo.Abp.Json;
using Volo.Abp.Json.SystemTextJson;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.TextTemplating;
using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Abp.Notifications
@ -21,7 +22,8 @@ namespace LINGYUN.Abp.Notifications
typeof(AbpIdGeneratorModule),
typeof(AbpJsonModule),
typeof(AbpLocalizationModule),
typeof(AbpRealTimeModule))]
typeof(AbpRealTimeModule),
typeof(AbpTextTemplatingCoreModule))]
public class AbpNotificationModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
@ -47,6 +49,12 @@ namespace LINGYUN.Abp.Notifications
{
options.UnsupportedTypes.Add<NotificationInfo>();
});
var preActions = context.Services.GetPreConfigureActions<AbpNotificationOptions>();
Configure<AbpNotificationOptions>(options =>
{
preActions.Configure(options);
});
}
private void AutoAddDefinitionProviders(IServiceCollection services)
@ -61,10 +69,8 @@ namespace LINGYUN.Abp.Notifications
}
});
var preActions = services.GetPreConfigureActions<AbpNotificationOptions>();
Configure<AbpNotificationOptions>(options =>
{
preActions.Configure(options);
options.DefinitionProviders.AddIfNotContains(definitionProviders);
});
}

23
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationTemplateDefinitionProvider.cs

@ -0,0 +1,23 @@
using System.Linq;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.Notifications;
public class AbpNotificationTemplateDefinitionProvider : TemplateDefinitionProvider
{
private readonly INotificationDefinitionManager _notificationDefinitionManager;
public AbpNotificationTemplateDefinitionProvider(
INotificationDefinitionManager notificationDefinitionManager)
{
_notificationDefinitionManager = notificationDefinitionManager;
}
public override void Define(ITemplateDefinitionContext context)
{
var notifications = _notificationDefinitionManager.GetAll().Where(n => n.Template != null);
foreach (var notification in notifications)
{
context.Add(notification.Template);
}
}
}

9
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/INotificationTemplateStore.cs

@ -1,9 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
namespace LINGYUN.Abp.Notifications;
public interface INotificationTemplateStore
{
Task<string> GetOrNullAsync(string templateName, string culture = null, CancellationToken cancellationToken = default);
}

14
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/en.json

@ -1,12 +1,24 @@
{
"culture": "en",
"texts": {
"Notifications": "Notifications",
"Notifications:Title": "Title",
"Notifications:Content": "Content",
"Notifications:Type": "Type",
"Notifications:SendTime": "SendTime",
"Notifications:System": "System",
"Notifications:Application": "Platform",
"Notifications:User": "User",
"Notifications:Internal": "Internal",
"Notifications:OnsideNotice": "Onside",
"Notifications:OnsideNoticeDesc": "In-app notification push",
"Notifications:ActivityNotice": "Activity",
"Notifications:ActivityNoticeDesc": "The administrator delivers an event notification push",
"Notifications:SystemNotice": "System",
"Notifications:SystemNoticeDesc": "System global notification push"
"Notifications:SystemNoticeDesc": "System global notification push",
"MarkSelectedAsRead": "Mark selected as read",
"MarkAs": "Mark as",
"Read": "Read",
"UnRead": "Un Read"
}
}

14
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Localization/Resources/zh-Hans.json

@ -1,12 +1,24 @@
{
"culture": "zh-Hans",
"texts": {
"Notifications": "通知列表",
"Notifications:Title": "标题",
"Notifications:Content": "内容",
"Notifications:Type": "类型",
"Notifications:SendTime": "发送时间",
"Notifications:System": "系统",
"Notifications:Application": "平台",
"Notifications:User": "用户",
"Notifications:Internal": "内置通知",
"Notifications:OnsideNotice": "站内通知",
"Notifications:OnsideNoticeDesc": "应用内部通知推送",
"Notifications:ActivityNotice": "活动通知",
"Notifications:ActivityNoticeDesc": "管理员下发活动通知推送",
"Notifications:SystemNotice": "系统通知",
"Notifications:SystemNoticeDesc": "系统全局消息推送"
"Notifications:SystemNoticeDesc": "系统全局消息推送",
"MarkSelectedAsRead": "标记选中已读",
"MarkAs": "标记为",
"Read": "已读",
"UnRead": "未读"
}
}

45
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationDefinition.cs

@ -3,12 +3,13 @@ using System;
using System.Collections.Generic;
using Volo.Abp;
using Volo.Abp.Localization;
using Volo.Abp.TextTemplating;
/*
* 2020-10-29
* INotificationSender指定接收者,,,()
*/
*/
namespace LINGYUN.Abp.Notifications
{
public class NotificationDefinition
@ -49,6 +50,10 @@ namespace LINGYUN.Abp.Notifications
/// 通知提供者
/// </summary>
public List<string> Providers { get; }
/// <summary>
/// 通知模板
/// </summary>
public TemplateDefinition Template { get; private set; }
/// <summary>
/// 额外属性
/// </summary>
@ -84,6 +89,40 @@ namespace LINGYUN.Abp.Notifications
return this;
}
public virtual NotificationDefinition WithTemplate(
Type localizationResource = null,
bool isLayout = false,
string layout = null,
string defaultCultureName = null)
{
Template = new TemplateDefinition(
Name,
localizationResource,
DisplayName,
isLayout,
layout,
defaultCultureName);
return this;
}
public virtual NotificationDefinition WithTemplate(Action<TemplateDefinition> setup)
{
if (Template != null)
{
setup(Template);
}
else
{
var template = new TemplateDefinition(Name);
setup(template);
Template = template;
}
return this;
}
public virtual NotificationDefinition WithProperty(string key, object value)
{
Properties[key] = value;

6
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationTemplate.cs

@ -14,7 +14,6 @@ namespace LINGYUN.Abp.Notifications;
public class NotificationTemplate : IHasExtraProperties
{
public string Name { get; set; }
public string Title { get; set; }
public string Culture { get; set; }
public string FormUser { get; set; }
public object this[string key]
@ -27,16 +26,17 @@ public class NotificationTemplate : IHasExtraProperties
}
}
public ExtraPropertyDictionary ExtraProperties { get; set; }
public NotificationTemplate() { }
public NotificationTemplate(
string name,
string title,
string culture = null,
string formUser = null,
IDictionary<string, object> data = null)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name));
Title = title;
Culture = culture;
FormUser = formUser;

16
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationTemplateStore.cs

@ -1,16 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace LINGYUN.Abp.Notifications;
[Dependency(TryRegister = true)]
public class NullNotificationTemplateStore : INotificationTemplateStore, ISingletonDependency
{
public readonly static INotificationTemplateStore Instance = new NullNotificationTemplateStore();
public Task<string> GetOrNullAsync(string templateName, string culture = null, CancellationToken cancellationToken = default)
{
return Task.FromResult<string>(null);
}
}

5
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationSendDto.cs

@ -1,5 +1,6 @@
using LINGYUN.Abp.Notifications;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Abp.MessageService.Notifications
@ -10,7 +11,9 @@ namespace LINGYUN.Abp.MessageService.Notifications
[StringLength(NotificationConsts.MaxNameLength)]
public string Name { get; set; }
public NotificationData Data { get; set; } = new NotificationData();
public Dictionary<string, object> Data { get; set; } = new Dictionary<string, object>();
public string Culture { get; set; }
public Guid? ToUserId { get; set; }

10
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationTemplateDto.cs

@ -0,0 +1,10 @@
namespace LINGYUN.Abp.MessageService.Notifications;
public class NotificationTemplateDto
{
public string Name { get; set; }
public string Description { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public string Culture { get; set; }
}

5
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/INotificationAppService.cs

@ -1,9 +1,12 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.MessageService.Notifications
{
public interface INotificationAppService
{
Task<ListResultDto<NotificationTemplateDto>> GetAssignableTemplatesAsync();
Task SendAsync(NotificationSendDto input);
}
}

16
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/MyNotificationAppService.cs

@ -31,22 +31,6 @@ namespace LINGYUN.Abp.MessageService.Notifications
NotificationDefinitionManager = notificationDefinitionManager;
}
public async virtual Task SendNofiterAsync(NotificationSendDto input)
{
UserIdentifier user = null;
if (input.ToUserId.HasValue)
{
user = new UserIdentifier(input.ToUserId.Value, input.ToUserName);
}
await NotificationSender
.SendNofiterAsync(
input.Name,
input.Data,
user,
CurrentTenant.Id,
input.Severity);
}
public async virtual Task MarkReadStateAsync(NotificationMarkReadStateInput input)
{
await NotificationStore.ChangeUserNotificationsReadStateAsync(

65
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/NotificationAppService.cs

@ -1,35 +1,88 @@
using LINGYUN.Abp.Notifications;
using Microsoft.AspNetCore.Authorization;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.MessageService.Notifications
{
[Authorize]
public class NotificationAppService : ApplicationService, INotificationAppService
{
protected ITemplateContentProvider TemplateContentProvider { get; }
protected INotificationSender NotificationSender { get; }
protected INotificationDefinitionManager NotificationDefinitionManager { get; }
public NotificationAppService(
INotificationSender notificationSender)
INotificationSender notificationSender,
ITemplateContentProvider templateContentProvider,
INotificationDefinitionManager notificationDefinitionManager)
{
NotificationSender = notificationSender;
TemplateContentProvider = templateContentProvider;
NotificationDefinitionManager = notificationDefinitionManager;
}
public virtual Task<ListResultDto<NotificationTemplateDto>> GetAssignableTemplatesAsync()
{
var templates = new List<NotificationTemplateDto>();
var notifications = NotificationDefinitionManager.GetAll().Where(n => n.Template != null);
foreach (var notification in notifications)
{
templates.Add(
new NotificationTemplateDto
{
Name = notification.Name,
Culture = CultureInfo.CurrentCulture.Name,
Title = notification.DisplayName.Localize(StringLocalizerFactory),
Description = notification.Description?.Localize(StringLocalizerFactory),
});
}
return Task.FromResult(new ListResultDto<NotificationTemplateDto>(templates));
}
public virtual async Task SendAsync(NotificationSendDto input)
public async virtual Task SendAsync(NotificationSendDto input)
{
var notification = GetNotificationDefinition(input.Name);
UserIdentifier user = null;
if (input.ToUserId.HasValue)
{
user = new UserIdentifier(input.ToUserId.Value, input.ToUserName);
}
await NotificationSender
.SendNofiterAsync(
input.Name,
input.Data,
user,
name: input.Name,
template: new NotificationTemplate(
notification.Name,
culture: input.Culture ?? CultureInfo.CurrentCulture.Name,
formUser: CurrentUser.Name ?? CurrentUser.UserName,
data: input.Data),
user: user,
CurrentTenant.Id,
input.Severity);
}
protected virtual NotificationDefinition GetNotificationDefinition(string name)
{
var notification = NotificationDefinitionManager.GetOrNull(name);
if (notification == null || notification.Template == null)
{
throw new BusinessException(
MessageServiceErrorCodes.NotificationTemplateNotFound,
$"The notification template {name} does not exist!")
.WithData("Name", name);
}
return notification;
}
}
}

17
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/en.json

@ -18,22 +18,7 @@
"LINGYUN.Abp.Message:03404": "Sending the message failed: the user does not exist or is deactivated!",
"LINGYUN.Abp.Message:03410": "Users refuse to add friends",
"LINGYUN.Abp.Message:03411": "The other party is already your friend or has sent an authentication request. The operation cannot be repeated!",
"MarkSelectedAsRead": "Mark selected as read",
"MarkAs": "Mark as",
"Read": "Read",
"UnRead": "Un Read",
"Notifications": "Notifications",
"Notifications:Title": "Title",
"Notifications:Content": "Content",
"Notifications:Type": "Type",
"Notifications:SendTime": "SendTime",
"Notifications:System": "System",
"Notifications:Application": "Platform",
"Notifications:User": "User",
"Notifications:MultiTenancy": "Multi Tenancy",
"Notifications:Users": "Users",
"Notifications:NewTenantRegisterd": "Tenant creation notification",
"Notifications:WelcomeToApplication": "User Welcome Notice",
"LINGYUN.Abp.Message:05404": "The notification template does not exist!",
"Notifications:IM": "Instant Messaging",
"Notifications:FriendValidation": "Friend verification notification",
"Notifications:NewFriend": "New friend notification",

18
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json

@ -18,22 +18,7 @@
"LINGYUN.Abp.Message:03404": "发送消息失败: 用户不存在或已注销账号!",
"LINGYUN.Abp.Message:03410": "用户拒绝添加好友",
"LINGYUN.Abp.Message:03411": "对方已是您的好友或已发送验证请求,不能重复操作!",
"MarkSelectedAsRead": "标记选中已读",
"MarkAs": "标记为",
"Read": "已读",
"UnRead": "未读",
"Notifications": "通知列表",
"Notifications:Title": "标题",
"Notifications:Content": "内容",
"Notifications:Type": "类型",
"Notifications:SendTime": "发送时间",
"Notifications:System": "系统",
"Notifications:Application": "平台",
"Notifications:User": "用户",
"Notifications:MultiTenancy": "租户通知",
"Notifications:Users": "用户通知",
"Notifications:NewTenantRegisterd": "租户创建通知",
"Notifications:WelcomeToApplication": "用户欢迎通知",
"LINGYUN.Abp.Message:05404": "通知模板不存在!",
"Notifications:IM": "即时通讯",
"Notifications:FriendValidation": "好友验证通知",
"Notifications:NewFriend": "新好友通知",
@ -45,6 +30,5 @@
"AddNewFriendBySearchId": "通过账号搜索添加",
"WelcomeToApplicationFormUser": "用户:{User} 欢迎您的加入!",
"Messages:NewFriend": "我已经添加您为好友,让我们一起聊天吧!"
}
}

4
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/MessageServiceErrorCodes.cs

@ -99,5 +99,9 @@
/// 你需要验证问题才能添加好友
/// </summary>
public const string YouNeedValidationQuestingByAddFriend = Namespace + ":03302";
/// <summary>
/// 通知模板不存在!
/// </summary>
public const string NotificationTemplateNotFound = Namespace + ":05404";
}
}

14
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Notifications/NotificationTemplateConsts.cs

@ -0,0 +1,14 @@
namespace LINGYUN.Abp.MessageService.Notifications;
public static class NotificationTemplateConsts
{
public static int MaxNameLength { get; set; } = 100;
public static int MaxTitleLength { get; set; } = 100;
public static int MaxContentLength { get; set; } = 1024 * 1024;
public static int MaxDescriptionLength { get; set; } = 255;
public static int MaxCultureLength { get; set; } = 30;
}

19
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs

@ -17,6 +17,25 @@ namespace LINGYUN.Abp.MessageService.Mapper
{
public MessageServiceDomainAutoMapperProfile()
{
CreateMap<Notification, NotificationInfo>()
.ForMember(dto => dto.Id, map => map.MapFrom(src => src.NotificationId.ToString()))
.ForMember(dto => dto.Name, map => map.MapFrom(src => src.NotificationName))
.ForMember(dto => dto.Lifetime, map => map.Ignore())
.ForMember(dto => dto.Type, map => map.MapFrom(src => src.Type))
.ForMember(dto => dto.Severity, map => map.MapFrom(src => src.Severity))
.ForMember(dto => dto.CreationTime, map => map.MapFrom(src => src.CreationTime))
.ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) =>
{
var dataType = Type.GetType(src.NotificationTypeName);
var data = Activator.CreateInstance(dataType);
if (data is NotificationData notificationData)
{
notificationData.ExtraProperties = src.ExtraProperties;
return notificationData;
}
return new NotificationData();
}));
CreateMap<UserNotificationInfo, NotificationInfo>()
.ForMember(dto => dto.Id, map => map.MapFrom(src => src.Id.ToString()))
.ForMember(dto => dto.Name, map => map.MapFrom(src => src.Name))

36
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/AbpMessageServiceNotificationDefinitionProvider.cs

@ -1,8 +1,6 @@
using LINGYUN.Abp.MessageService.Localization;
using LINGYUN.Abp.Notifications;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Users;
namespace LINGYUN.Abp.MessageService.Notifications
{
@ -10,40 +8,6 @@ namespace LINGYUN.Abp.MessageService.Notifications
{
public override void Define(INotificationDefinitionContext context)
{
var tenantsGroup = context.AddGroup(
TenantNotificationNames.GroupName,
L("Notifications:MultiTenancy"),
false);
tenantsGroup.AddNotification(
TenantNotificationNames.NewTenantRegistered,
L("Notifications:NewTenantRegisterd"),
L("Notifications:NewTenantRegisterd"),
notificationType: NotificationType.System,
lifetime: NotificationLifetime.OnlyOne,
allowSubscriptionToClients: false
)
.WithProviders(
NotificationProviderNames.SignalR,
NotificationProviderNames.Emailing)
.WithProperty("Template", "NewTenantRegisterd");
var usersGroup = context.AddGroup(
UserNotificationNames.GroupName,
L("Notifications:Users"));
usersGroup.AddNotification(
UserNotificationNames.WelcomeToApplication,
L("Notifications:WelcomeToApplication"),
L("Notifications:WelcomeToApplication"),
notificationType: NotificationType.System,
lifetime: NotificationLifetime.OnlyOne,
allowSubscriptionToClients: true)
.WithProviders(
NotificationProviderNames.SignalR,
NotificationProviderNames.Emailing)
.WithProperty("Template", "WelcomeToApplication");
var imGroup = context.AddGroup(
MessageServiceNotificationNames.IM.GroupName,
L("Notifications:IM"));

11
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationTemplate.cs

@ -1,11 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Domain.Entities.Auditing;
namespace LINGYUN.Abp.MessageService.Notifications;
public class NotificationTemplate : AuditedAggregateRoot<Guid>
{
}

1
aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/AbpMessageServiceEntityFrameworkCoreModule.cs

@ -18,6 +18,7 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore
context.Services.AddAbpDbContext<MessageServiceDbContext>(options =>
{
options.AddRepository<Notification, EfCoreNotificationRepository>();
options.AddRepository<UserNotification, EfCoreUserNotificationRepository>();
options.AddRepository<UserSubscribe, EfCoreUserSubscribeRepository>();

14
aspnet-core/modules/message/LINGYUN.Abp.MessageService.HttpApi/LINGYUN/Abp/MessageService/Notifications/NotificationController.cs

@ -1,10 +1,13 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
namespace LINGYUN.Abp.MessageService.Notifications
{
[Authorize]
[RemoteService(Name = AbpMessageServiceConsts.RemoteServiceName)]
[Route("api/notifilers")]
public class NotificationController : AbpController, INotificationAppService
@ -18,9 +21,16 @@ namespace LINGYUN.Abp.MessageService.Notifications
}
[HttpPost]
public virtual async Task SendAsync(NotificationSendDto input)
public async virtual Task SendAsync(NotificationSendDto input)
{
await NotificationAppService.SendAsync(input);
}
[HttpGet]
[Route("assignable-templates")]
public async virtual Task<ListResultDto<NotificationTemplateDto>> GetAssignableTemplatesAsync()
{
return await NotificationAppService.GetAssignableTemplatesAsync();
}
}
}

3
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

24
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN.Abp.TextTemplating.Application.Contracts.csproj

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Authorization.Abstractions" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.TextTemplating.Domain.Shared\LINGYUN.Abp.TextTemplating.Domain.Shared.csproj" />
</ItemGroup>
</Project>

14
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationContractsModule.cs

@ -0,0 +1,14 @@
using Volo.Abp.Application;
using Volo.Abp.Authorization;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.TextTemplating;
[DependsOn(
typeof(AbpTextTemplatingDomainSharedModule),
typeof(AbpAuthorizationAbstractionsModule),
typeof(AbpDddApplicationContractsModule))]
public class AbpTextTemplatingApplicationContractsModule : AbpModule
{
}

8
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/AbpTextTemplatingRemoteServiceConsts.cs

@ -0,0 +1,8 @@
namespace LINGYUN.Abp.TextTemplating;
public class AbpTextTemplatingRemoteServiceConsts
{
public const string RemoteServiceName = "AbpTextTemplating";
public const string ModuleName = "text-templating";
}

16
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/ITextTemplateAppService.cs

@ -0,0 +1,16 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.TextTemplating;
public interface ITextTemplateAppService : IApplicationService
{
Task<TextTemplateDto> GetAsync(TextTemplateGetInput input);
Task ResetDefaultAsync(TextTemplateGetInput input);
Task<TextTemplateDto> UpdateAsync(TextTemplateUpdateInput input);
Task<ListResultDto<TextTemplateDto>> GetListAsync();
}

23
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/Permissions/AbpTextTemplatingPermissionDefinitionProvider.cs

@ -0,0 +1,23 @@
using LINGYUN.Abp.TextTemplating.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
namespace LINGYUN.Abp.TextTemplating;
public class AbpTextTemplatingPermissionDefinitionProvider : PermissionDefinitionProvider
{
public override void Define(IPermissionDefinitionContext context)
{
var saasGroup = context.AddGroup(AbpTextTemplatingPermissions.GroupName, L("Permission:Saas"));
var textTemplatePermission = saasGroup.AddPermission(AbpTextTemplatingPermissions.TextTemplate.Default, L("Permission:TextTemplates"));
textTemplatePermission.AddChild(AbpTextTemplatingPermissions.TextTemplate.Create, L("Permission:Create"));
textTemplatePermission.AddChild(AbpTextTemplatingPermissions.TextTemplate.Update, L("Permission:Edit"));
textTemplatePermission.AddChild(AbpTextTemplatingPermissions.TextTemplate.Delete, L("Permission:Delete"));
}
private static LocalizableString L(string name)
{
return LocalizableString.Create<AbpTextTemplatingResource>(name);
}
}

21
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/Permissions/AbpTextTemplatingPermissions.cs

@ -0,0 +1,21 @@
using Volo.Abp.Reflection;
namespace LINGYUN.Abp.TextTemplating;
public static class AbpTextTemplatingPermissions
{
public const string GroupName = "AbpTextTemplating";
public static class TextTemplate
{
public const string Default = GroupName + ".TextTemplates";
public const string Create = Default + ".Create";
public const string Update = Default + ".Update";
public const string Delete = Default + ".Delete";
}
public static string[] GetAll()
{
return ReflectionHelper.GetPublicConstantsRecursively(typeof(AbpTextTemplatingPermissions));
}
}

9
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateDto.cs

@ -0,0 +1,9 @@
namespace LINGYUN.Abp.TextTemplating;
public class TextTemplateDto
{
public string Name { get; set; }
public string DisplayName { get; set; }
public string Content { get; set; }
public string Culture { get; set; }
}

14
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateGetInput.cs

@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.TextTemplating;
public class TextTemplateGetInput
{
[Required]
[DynamicStringLength(typeof(TextTemplateConsts), nameof(TextTemplateConsts.MaxNameLength))]
public string Name { get; set; }
[DynamicStringLength(typeof(TextTemplateConsts), nameof(TextTemplateConsts.MaxCultureLength))]
public string Culture { get; set; }
}

19
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application.Contracts/LINGYUN/Abp/TextTemplating/TextTemplateUpdateInput.cs

@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.TextTemplating;
public class TextTemplateUpdateInput
{
[Required]
[DynamicStringLength(typeof(TextTemplateConsts), nameof(TextTemplateConsts.MaxNameLength))]
public string Name { get; set; }
[Required]
[DynamicStringLength(typeof(TextTemplateConsts), nameof(TextTemplateConsts.MaxCultureLength))]
public string Culture { get; set; }
[Required]
[DynamicStringLength(typeof(TextTemplateConsts), nameof(TextTemplateConsts.MaxContentLength))]
public string Content { get; set; }
}

3
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

21
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN.Abp.TextTemplating.Application.csproj

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.TextTemplating.Application.Contracts\LINGYUN.Abp.TextTemplating.Application.Contracts.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.TextTemplating.Domain\LINGYUN.Abp.TextTemplating.Domain.csproj" />
</ItemGroup>
</Project>

13
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingAppServiceBase.cs

@ -0,0 +1,13 @@
using LINGYUN.Abp.TextTemplating.Localization;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.TextTemplating;
public abstract class AbpTextTemplatingAppServiceBase : ApplicationService
{
protected AbpTextTemplatingAppServiceBase()
{
ObjectMapperContext = typeof(AbpTextTemplatingApplicationModule);
LocalizationResource = typeof(AbpTextTemplatingResource);
}
}

11
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationAutoMapperProfile.cs

@ -0,0 +1,11 @@
using AutoMapper;
namespace LINGYUN.Abp.TextTemplating;
public class AbpTextTemplatingApplicationAutoMapperProfile : Profile
{
public AbpTextTemplatingApplicationAutoMapperProfile()
{
CreateMap<TextTemplate, TextTemplateDto>();
}
}

23
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationModule.cs

@ -0,0 +1,23 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Application;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.TextTemplating;
[DependsOn(
typeof(AbpTextTemplatingDomainModule),
typeof(AbpTextTemplatingApplicationContractsModule),
typeof(AbpAutoMapperModule),
typeof(AbpDddApplicationModule))]
public class AbpTextTemplatingApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<AbpTextTemplatingApplicationModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpTextTemplatingApplicationAutoMapperProfile>(validate: true);
});
}
}

135
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/TextTemplateAppService.cs

@ -0,0 +1,135 @@
using Microsoft.AspNetCore.Authorization;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Localization;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.TextTemplating;
[Authorize(AbpTextTemplatingPermissions.TextTemplate.Default)]
public class TextTemplateAppService : AbpTextTemplatingAppServiceBase, ITextTemplateAppService
{
protected ITextTemplateRepository TextTemplateRepository { get; }
protected ITemplateContentProvider TemplateContentProvider { get; }
protected ITemplateDefinitionManager TemplateDefinitionManager { get; }
public TextTemplateAppService(
ITextTemplateRepository textTemplateRepository,
ITemplateContentProvider templateContentProvider,
ITemplateDefinitionManager templateDefinitionManager)
{
TextTemplateRepository = textTemplateRepository;
TemplateContentProvider = templateContentProvider;
TemplateDefinitionManager = templateDefinitionManager;
}
public async virtual Task<TextTemplateDto> GetAsync(TextTemplateGetInput input)
{
var templateDefinition = GetTemplateDefinition(input.Name);
var culture = input.Culture ?? CultureInfo.CurrentCulture.Name ?? templateDefinition.DefaultCultureName;
using (CultureHelper.Use(culture, culture))
{
var content = await TemplateContentProvider.GetContentOrNullAsync(templateDefinition.Name, culture);
return new TextTemplateDto
{
Culture = culture,
Content = content,
Name = templateDefinition.Name,
DisplayName = templateDefinition.DisplayName.Localize(StringLocalizerFactory),
};
}
}
public Task<ListResultDto<TextTemplateDto>> GetListAsync()
{
var templates = new List<TextTemplateDto>();
var templateDefinitions = TemplateDefinitionManager.GetAll();
foreach (var templateDefinition in templateDefinitions)
{
templates.Add(
new TextTemplateDto
{
Name = templateDefinition.Name,
Culture = CultureInfo.CurrentCulture.Name ?? templateDefinition.DefaultCultureName,
DisplayName = templateDefinition.DisplayName.Localize(StringLocalizerFactory),
});
}
return Task.FromResult(new ListResultDto<TextTemplateDto>(templates));
}
[Authorize(AbpTextTemplatingPermissions.TextTemplate.Delete)]
public async virtual Task ResetDefaultAsync(TextTemplateGetInput input)
{
var templateDefinition = GetTemplateDefinition(input.Name);
var culture = input.Culture ?? CultureInfo.CurrentCulture.Name ?? templateDefinition.DefaultCultureName;
using (CultureHelper.Use(culture, culture))
{
var template = await TextTemplateRepository.FindByNameAsync(
templateDefinition.Name,
culture);
if (template != null)
{
await TextTemplateRepository.DeleteAsync(template);
}
}
}
[Authorize(AbpTextTemplatingPermissions.TextTemplate.Update)]
public async virtual Task<TextTemplateDto> UpdateAsync(TextTemplateUpdateInput input)
{
var templateDefinition = GetTemplateDefinition(input.Name);
var culture = input.Culture ?? CultureInfo.CurrentCulture.Name ?? templateDefinition.DefaultCultureName;
using (CultureHelper.Use(culture, culture))
{
var template = await TextTemplateRepository.FindByNameAsync(input.Name, culture);
if (template == null)
{
template = new TextTemplate(
GuidGenerator.Create(),
templateDefinition.Name,
templateDefinition.DisplayName.Localize(StringLocalizerFactory),
input.Content,
culture);
template = await TextTemplateRepository.InsertAsync(template);
}
else
{
template.SetContent(input.Content);
await TextTemplateRepository.UpdateAsync(template);
}
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<TextTemplate, TextTemplateDto>(template);
}
}
protected virtual TemplateDefinition GetTemplateDefinition(string name)
{
var template = TemplateDefinitionManager.GetOrNull(name);
if (template == null)
{
throw new BusinessException(
AbpTextTemplatingErrorCodes.TemplateNotFound,
$"The text template {name} does not exist!")
.WithData("Name", name);
}
return template;
}
}

3
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

20
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN.Abp.TextTemplating.Domain.Shared.csproj

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<None Remove="LINGYUN\Abp\TextTemplating\Localization\Resources\*.json" />
<EmbeddedResource Include="LINGYUN\Abp\TextTemplating\Localization\Resources\*.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Validation" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
</Project>

33
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainSharedModule.cs

@ -0,0 +1,33 @@
using LINGYUN.Abp.TextTemplating.Localization;
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Modularity;
using Volo.Abp.Validation;
using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Abp.TextTemplating;
[DependsOn(
typeof(AbpValidationModule))]
public class AbpTextTemplatingDomainSharedModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpTextTemplatingDomainSharedModule>();
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<AbpTextTemplatingResource>("en")
.AddVirtualJson("/LINGYUN/Abp/TextTemplating/Localization/Resources");
});
Configure<AbpExceptionLocalizationOptions>(options =>
{
options.MapCodeNamespace(AbpTextTemplatingErrorCodes.Namespace, typeof(AbpTextTemplatingResource));
});
}
}

11
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/AbpTextTemplatingErrorCodes.cs

@ -0,0 +1,11 @@
namespace LINGYUN.Abp.TextTemplating;
public static class AbpTextTemplatingErrorCodes
{
public const string Namespace = "TextTemplating";
/// <summary>
/// 模板不存在!
/// </summary>
public const string TemplateNotFound = Namespace + ":01404";
}

8
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/AbpTextTemplatingResource.cs

@ -0,0 +1,8 @@
using Volo.Abp.Localization;
namespace LINGYUN.Abp.TextTemplating.Localization;
[LocalizationResourceName("AbpTextTemplating")]
public class AbpTextTemplatingResource
{
}

5
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/en.json

@ -0,0 +1,5 @@
{
"culture": "en",
"texts": {
}
}

5
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/Localization/Resources/zh-Hans.json

@ -0,0 +1,5 @@
{
"culture": "zh-Hans",
"texts": {
}
}

12
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateConsts.cs

@ -0,0 +1,12 @@
namespace LINGYUN.Abp.TextTemplating;
public static class TextTemplateConsts
{
public static int MaxNameLength { get; set; } = 100;
public static int MaxDisplayNameLength { get; set; } = 100;
public static int MaxContentLength { get; set; } = 1024 * 1024;
public static int MaxCultureLength { get; set; } = 30;
}

3
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

4
aspnet-core/modules/common/LINGYUN.Abp.Notifications.TextTemplating/LINGYUN.Abp.Notifications.TextTemplating.csproj → aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj

@ -9,11 +9,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.TextTemplating.Core" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.Notifications\LINGYUN.Abp.Notifications.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.TextTemplating.Domain.Shared\LINGYUN.Abp.TextTemplating.Domain.Shared.csproj" />
</ItemGroup>
</Project>

12
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbProperties.cs

@ -0,0 +1,12 @@
using Volo.Abp.Data;
namespace LINGYUN.Abp.TextTemplating;
public class AbpTextTemplatingDbProperties
{
public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix;
public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema;
public const string ConnectionStringName = "AbpTextTemplating";
}

12
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs

@ -0,0 +1,12 @@
using Volo.Abp.Modularity;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.TextTemplating;
[DependsOn(
typeof(AbpTextTemplatingDomainSharedModule),
typeof(AbpTextTemplatingCoreModule))]
public class AbpTextTemplatingDomainModule : AbpModule
{
}

11
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/ITextTemplateRepository.cs

@ -0,0 +1,11 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
namespace LINGYUN.Abp.TextTemplating;
public interface ITextTemplateRepository : IBasicRepository<TextTemplate, Guid>
{
Task<TextTemplate> FindByNameAsync(string name, string culture = null, CancellationToken cancellationToken = default);
}

34
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplate.cs

@ -0,0 +1,34 @@
using System;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.TextTemplating;
public class TextTemplate : AuditedEntity<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual string Name { get; private set; }
public virtual string DisplayName { get; private set; }
public virtual string Content { get; private set; }
public virtual string Culture { get; private set; }
protected TextTemplate() { }
public TextTemplate(
Guid id,
string name,
string displayName,
string content,
string culture)
: base(id)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name), TextTemplateConsts.MaxNameLength);
DisplayName = Check.NotNullOrWhiteSpace(displayName, nameof(displayName), TextTemplateConsts.MaxDisplayNameLength);
Content = Check.NotNullOrWhiteSpace(content, nameof(content), TextTemplateConsts.MaxContentLength);
Culture = Check.NotNullOrWhiteSpace(culture, nameof(culture), TextTemplateConsts.MaxCultureLength);
}
public void SetContent(string content)
{
Content = Check.NotNullOrWhiteSpace(content, nameof(content), TextTemplateConsts.MaxContentLength);
}
}

17
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentContributor.cs

@ -0,0 +1,17 @@
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.TextTemplating;
public class TextTemplateContentContributor : ITemplateContentContributor, ITransientDependency
{
public async virtual Task<string> GetOrNullAsync(TemplateContentContributorContext context)
{
var repository = context.ServiceProvider.GetRequiredService<ITextTemplateRepository>();
var template = await repository.FindByNameAsync(context.TemplateDefinition.Name, context.Culture);
return template?.Content;
}
}

3
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

19
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.TextTemplating.Domain\LINGYUN.Abp.TextTemplating.Domain.csproj" />
</ItemGroup>
</Project>

45
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbContextModelCreatingExtensions.cs

@ -0,0 +1,45 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore;
public static class AbpTextTemplatingDbContextModelCreatingExtensions
{
public static void ConfigureTextTemplating(
this ModelBuilder builder)
{
Check.NotNull(builder, nameof(builder));
builder.Entity<TextTemplate>(b =>
{
b.ToTable(AbpTextTemplatingDbProperties.DbTablePrefix + "TextTemplates", AbpTextTemplatingDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(t => t.Name)
.HasColumnName(nameof(TextTemplate.Name))
.HasMaxLength(TextTemplateConsts.MaxNameLength)
.IsRequired();
b.Property(t => t.DisplayName)
.HasColumnName(nameof(TextTemplate.DisplayName))
.HasMaxLength(TextTemplateConsts.MaxDisplayNameLength)
.IsRequired();
b.Property(t => t.Culture)
.HasColumnName(nameof(TextTemplate.Culture))
.HasMaxLength(TextTemplateConsts.MaxCultureLength)
.IsRequired();
b.Property(t => t.Content)
.HasColumnName(nameof(TextTemplate.Content))
.HasMaxLength(TextTemplateConsts.MaxContentLength);
b.HasIndex(p => new { p.TenantId, p.Name })
.HasDatabaseName("IX_Tenant_Text_Template_Name");
b.ApplyObjectExtensionMappings();
});
builder.TryConfigureObjectExtensions<TextTemplatingDbContext>();
}
}

21
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingEntityFrameworkCoreModule.cs

@ -0,0 +1,21 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore;
[DependsOn(
typeof(AbpTextTemplatingDomainModule),
typeof(AbpEntityFrameworkCoreModule))]
public class AbpTextTemplatingEntityFrameworkCoreModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<TextTemplatingDbContext>(options =>
{
options.AddRepository<TextTemplate, EfCoreTextTemplateRepository>();
options.AddDefaultRepositories<ITextTemplatingDbContext>();
});
}
}

31
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/EfCoreTextTemplateRepository.cs

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore;
public class EfCoreTextTemplateRepository :
EfCoreRepository<ITextTemplatingDbContext, TextTemplate, Guid>,
ITextTemplateRepository,
ITransientDependency
{
public EfCoreTextTemplateRepository(
IDbContextProvider<ITextTemplatingDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public async virtual Task<TextTemplate> FindByNameAsync(string name, string culture = null, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.Where(x => x.Name.Equals(name))
.WhereIf(!culture.IsNullOrWhiteSpace(), x => x.Culture.Equals(culture))
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
}

13
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/ITextTemplatingDbContext.cs

@ -0,0 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore;
[IgnoreMultiTenancy]
[ConnectionStringName(AbpTextTemplatingDbProperties.ConnectionStringName)]
public interface ITextTemplatingDbContext : IEfCoreDbContext
{
DbSet<TextTemplate> TextTemplates { get; }
}

25
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/TextTemplatingDbContext.cs

@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore;
[IgnoreMultiTenancy]
[ConnectionStringName(AbpTextTemplatingDbProperties.ConnectionStringName)]
public class TextTemplatingDbContext : AbpDbContext<TextTemplatingDbContext>, ITextTemplatingDbContext
{
public DbSet<TextTemplate> TextTemplates { get; set; }
public TextTemplatingDbContext(DbContextOptions<TextTemplatingDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigureTextTemplating();
}
}

5
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/TextTemplatingEfCoreQueryableExtensions.cs

@ -0,0 +1,5 @@
namespace LINGYUN.Abp.TextTemplating.EntityFrameworkCore;
public static class TextTemplatingEfCoreQueryableExtensions
{
}

3
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

19
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/LINGYUN.Abp.TextTemplating.HttpApi.Client.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Http.Client" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.TextTemplating.Application.Contracts\LINGYUN.Abp.TextTemplating.Application.Contracts.csproj" />
</ItemGroup>
</Project>

19
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi.Client/LINGYUN/Abp/TextTemplating/AbpTextTemplatingHttpApiClientModule.cs

@ -0,0 +1,19 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Http.Client;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.TextTemplating;
[DependsOn(
typeof(AbpTextTemplatingApplicationContractsModule),
typeof(AbpHttpClientModule))]
public class AbpTextTemplatingHttpApiClientModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(
typeof(AbpTextTemplatingApplicationContractsModule).Assembly,
AbpTextTemplatingRemoteServiceConsts.RemoteServiceName
);
}
}

3
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

19
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN.Abp.TextTemplating.HttpApi.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.TextTemplating.Application.Contracts\LINGYUN.Abp.TextTemplating.Application.Contracts.csproj" />
</ItemGroup>
</Project>

12
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/AbpTextTemplatingControllerBase.cs

@ -0,0 +1,12 @@
using LINGYUN.Abp.TextTemplating.Localization;
using Volo.Abp.AspNetCore.Mvc;
namespace LINGYUN.Abp.TextTemplating;
public abstract class AbpTextTemplatingControllerBase : AbpControllerBase
{
protected AbpTextTemplatingControllerBase()
{
LocalizationResource = typeof(AbpTextTemplatingResource);
}
}

40
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/AbpTextTemplatingHttpApiModule.cs

@ -0,0 +1,40 @@
using LINGYUN.Abp.TextTemplating.Localization;
using Localization.Resources.AbpUi;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.TextTemplating;
[DependsOn(
typeof(AbpTextTemplatingApplicationContractsModule),
typeof(AbpAspNetCoreMvcModule))]
public class AbpTextTemplatingHttpApiModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<IMvcBuilder>(mvcBuilder =>
{
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpTextTemplatingHttpApiModule).Assembly);
});
PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options =>
{
options.AddAssemblyResource(
typeof(AbpTextTemplatingResource),
typeof(AbpTextTemplatingApplicationContractsModule).Assembly);
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Get<AbpTextTemplatingResource>()
.AddBaseTypes(typeof(AbpUiResource));
});
}
}

53
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.HttpApi/LINGYUN/Abp/TextTemplating/TextTemplateController.cs

@ -0,0 +1,53 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.TextTemplating;
[Controller]
[Authorize(AbpTextTemplatingPermissions.TextTemplate.Default)]
[RemoteService(Name = AbpTextTemplatingRemoteServiceConsts.RemoteServiceName)]
[Area(AbpTextTemplatingRemoteServiceConsts.ModuleName)]
[Route("api/text-templating/templates")]
public class TextTemplateController : AbpTextTemplatingControllerBase, ITextTemplateAppService
{
protected ITextTemplateAppService TextTemplateAppService { get; }
public TextTemplateController(
ITextTemplateAppService textTemplateAppService)
{
TextTemplateAppService = textTemplateAppService;
}
[HttpGet]
[Route("{Name}")]
[Route("{Culture}/{Name}")]
public Task<TextTemplateDto> GetAsync(TextTemplateGetInput input)
{
return TextTemplateAppService.GetAsync(input);
}
[HttpGet]
public Task<ListResultDto<TextTemplateDto>> GetListAsync()
{
return TextTemplateAppService.GetListAsync();
}
[HttpDelete]
[Route("{Name}")]
[Route("{Culture}/{Name}")]
[Authorize(AbpTextTemplatingPermissions.TextTemplate.Delete)]
public Task ResetDefaultAsync(TextTemplateGetInput input)
{
return TextTemplateAppService.ResetDefaultAsync(input);
}
[HttpPost]
[Authorize(AbpTextTemplatingPermissions.TextTemplate.Update)]
public Task<TextTemplateDto> UpdateAsync(TextTemplateUpdateInput input)
{
return TextTemplateAppService.UpdateAsync(input);
}
}

5
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.Configure.cs

@ -326,6 +326,11 @@ public partial class BackendAdminHttpApiHostModule
options.Audience = configuration["AuthServer:ApiName"];
});
if (isDevelopment)
{
// services.AddAlwaysAllowAuthorization();
}
if (!isDevelopment)
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save