RazorLight icon indicating copy to clipboard operation
RazorLight copied to clipboard

Layout value on EntityFrameworkRazorProject

Open ogazioglu opened this issue 6 years ago • 2 comments

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?

ogazioglu avatar Sep 23 '20 19:09 ogazioglu

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

HamiltonManalo avatar Sep 30 '20 08:09 HamiltonManalo

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.

ogazioglu avatar Oct 01 '20 12:10 ogazioglu