FluentEmail
FluentEmail copied to clipboard
Add ability to pass ViewBag to renderer
I would like the ability to pass a ViewBag to the renderer so that data can be passed to layouts. The RazorLightEngine already has this capability via RazorLightEngine.Parse<T>(string key, T model, ExpandoObject viewBag) (https://github.com/toddams/RazorLight/blob/master/src/RazorLight/RazorLightEngine.cs#L57) but UsingTemplateFromFile() calls RazorLightEngine.ParseString().
@judowalker would the context pattern used here https://github.com/lukencode/FluentEmail/pull/252 meet your requirements?
@SimonCropp I think the idea of the ViewBag would be to help pass data to the Layout file.
Looks like there is a pull request but not sure what the status is: https://github.com/lukencode/FluentEmail/pull/145
UPDATE Actually this can be achieved currently using the following method: https://github.com/lukencode/FluentEmail/issues/171#issuecomment-570773949
Check out the source code it seems this should already be there: https://github.com/lukencode/FluentEmail/commit/c4edbfa0f11b80daf2b5b31a1d90f903a5050b3c#diff-72653a1101d601113d5f3f8e9947a374334a7b5d9c39ea538b12b503b5d0c345