예제 #1
0
        private string GetFullFile(Mailable mailable, EmailTemplate emailTemplate)
        {
            if (emailTemplate.File.IsEmpty())
            {
                emailTemplate.File = mailable.GetType().Name + ".cshtml";
            }

            else if (emailTemplate.File.EndsWith(".cshtml") == false)
            {
                emailTemplate.File += ".cshtml";
            }

            var type = mailable.GetType();

            var dirs = type.Namespace !.Replace(type.Assembly.GetName().Name !, string.Empty).Split('.', StringSplitOptions.RemoveEmptyEntries);

            var path = string.Join(Path.DirectorySeparatorChar, dirs);

            if (_options.TemplatePath.IsNotEmpty())
            {
                return(A.Path(_options.TemplatePath) / path / emailTemplate.File);
            }

            return(A.Path(path) / emailTemplate.File);
        }
예제 #2
0
        private string GetFullFile(Mailable mailable, EmailTemplate emailTemplate)
        {
            string templateFile;

            if (emailTemplate.File.StartsWith("_"))
            {
                templateFile = $"{emailTemplate.File}.mail.cshtml";
            }
            else
            {
                templateFile = $"_{emailTemplate.File}.mail.cshtml";
            }

            var type = mailable.GetType();

            var dirs = type.Namespace !.Replace(type.Assembly.GetName().Name !, string.Empty).Split('.', StringSplitOptions.RemoveEmptyEntries);

            var path = string.Join(Path.DirectorySeparatorChar, dirs);

            if (_options.TemplatePath.IsNotEmpty())
            {
                return(A.Path(_options.TemplatePath) / path / templateFile);
            }

            return(A.Path(path) / templateFile);
        }