toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.51k stars 261 forks source link

Layout value on EntityFrameworkRazorProject #375

Closed ogazioglu closed 3 years ago

ogazioglu commented 3 years ago

I couldn't find any documentation for using Layout with entityframework.

What should we set to Layout property of the template when in EntityFramework project? Should we use a templateKey, for ex. a guid?

HamiltonManalo commented 3 years ago

Hi There,

I haven't tested this personally, but in the sample project there is an example which shows how it is setup. According to the example you link layouts via PK so you seem to be on track. https://github.com/toddams/RazorLight/blob/1e393ebf377417fc79120d5921273296f46efdd1/samples/RazorLight.Samples/Program.cs#L40

ogazioglu commented 3 years ago

Hi,

I have tested and seen that you needn't to do anything extra. Layout should stay as .cshtml link. Provider tries to find layout with page name as templateKey in database. So, the only thing you have to do is to store your layout page in the database with its name.

Thanks again.