mirror of https://github.com/abpframework/abp.git
11 changed files with 110 additions and 66 deletions
@ -1,36 +0,0 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Abp.Emailing.Templates |
|||
{ |
|||
public class EmailTemplateDefinition |
|||
{ |
|||
public const string DefaultLayoutPlaceHolder = "_"; |
|||
|
|||
public string Name { get; } |
|||
|
|||
public bool IsLayout { get; } |
|||
|
|||
public string Layout { get; set; } |
|||
|
|||
public Type LocalizationResource { get; set; } |
|||
|
|||
public EmailTemplateContributorList Contributors { get; } |
|||
|
|||
public string DefaultCultureName { get; } |
|||
|
|||
public bool SingleTemplateFile { get; } |
|||
|
|||
public EmailTemplateDefinition([NotNull] string name, Type localizationResource = null, bool isLayout = false, |
|||
string layout = DefaultLayoutPlaceHolder, string defaultCultureName = null, bool singleTemplateFile = false) |
|||
{ |
|||
Name = Check.NotNullOrWhiteSpace(name, nameof(name)); |
|||
LocalizationResource = localizationResource; |
|||
Contributors = new EmailTemplateContributorList(); |
|||
IsLayout = isLayout; |
|||
Layout = layout; |
|||
DefaultCultureName = defaultCultureName; |
|||
SingleTemplateFile = singleTemplateFile; |
|||
} |
|||
} |
|||
} |
|||
@ -1,18 +0,0 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.Emailing.Templates |
|||
{ |
|||
public class EmailTemplateInitializationContext |
|||
{ |
|||
public EmailTemplateDefinition EmailTemplateDefinition { get; } |
|||
|
|||
public IServiceProvider ServiceProvider { get; } |
|||
|
|||
public EmailTemplateInitializationContext(EmailTemplateDefinition emailTemplateDefinition, |
|||
IServiceProvider serviceProvider) |
|||
{ |
|||
EmailTemplateDefinition = emailTemplateDefinition; |
|||
ServiceProvider = serviceProvider; |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
namespace Volo.Abp.Emailing.Templates |
|||
{ |
|||
public interface IEmailTemplateContributor |
|||
{ |
|||
void Initialize(EmailTemplateInitializationContext context); |
|||
|
|||
string GetOrNull(string cultureName); |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
namespace Volo.Abp.TextTemplating |
|||
{ |
|||
public interface ITemplateContributor |
|||
{ |
|||
void Initialize(TemplateContributorInitializationContext context); |
|||
|
|||
string GetOrNull(string cultureName); |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Abp.TextTemplating |
|||
{ |
|||
public class TemplateContributorInitializationContext |
|||
{ |
|||
[NotNull] |
|||
public TemplateDefinition TemplateDefinition { get; } |
|||
|
|||
[NotNull] |
|||
public IServiceProvider ServiceProvider { get; } |
|||
|
|||
public TemplateContributorInitializationContext( |
|||
TemplateDefinition templateDefinition, |
|||
IServiceProvider serviceProvider) |
|||
{ |
|||
TemplateDefinition = Check.NotNull(templateDefinition, nameof(templateDefinition)); |
|||
ServiceProvider = Check.NotNull(serviceProvider, nameof(serviceProvider)); |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +1,9 @@ |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
|
|||
namespace Volo.Abp.Emailing.Templates |
|||
namespace Volo.Abp.TextTemplating |
|||
{ |
|||
public class EmailTemplateContributorList : List<IEmailTemplateContributor> |
|||
public class TemplateContributorList : List<ITemplateContributor> |
|||
{ |
|||
public string GetOrNull(string cultureName) |
|||
{ |
|||
@ -0,0 +1,44 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Abp.TextTemplating |
|||
{ |
|||
public class TemplateDefinition |
|||
{ |
|||
public const string DefaultLayoutPlaceHolder = "_"; |
|||
|
|||
[NotNull] |
|||
public string Name { get; } |
|||
|
|||
public bool IsLayout { get; } |
|||
|
|||
[CanBeNull] |
|||
public string Layout { get; set; } |
|||
|
|||
public Type LocalizationResource { get; set; } //TODO: ???
|
|||
|
|||
public TemplateContributorList Contributors { get; } |
|||
|
|||
[CanBeNull] |
|||
public string DefaultCultureName { get; } |
|||
|
|||
public bool SingleTemplateFile { get; } //TODO: ???
|
|||
|
|||
public TemplateDefinition( |
|||
[NotNull] string name, |
|||
Type localizationResource = null, |
|||
bool isLayout = false, |
|||
string layout = DefaultLayoutPlaceHolder, |
|||
string defaultCultureName = null, |
|||
bool singleTemplateFile = false) |
|||
{ |
|||
Name = Check.NotNullOrWhiteSpace(name, nameof(name)); |
|||
LocalizationResource = localizationResource; |
|||
Contributors = new TemplateContributorList(); |
|||
IsLayout = isLayout; |
|||
Layout = layout; |
|||
DefaultCultureName = defaultCultureName; |
|||
SingleTemplateFile = singleTemplateFile; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\common.test.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" /> |
|||
<ProjectReference Include="..\..\src\Volo.Abp.TextTemplating\Volo.Abp.TextTemplating.csproj" /> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.TextTemplating |
|||
{ |
|||
public class AbpTextTemplatingTestModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
Loading…
Reference in new issue