Umbraco-v8-Tutorial icon indicating copy to clipboard operation
Umbraco-v8-Tutorial copied to clipboard

Lack of strongly typed models in CleanBlog.Core

Open creativesuspects opened this issue 5 years ago • 1 comments

I've watched a couple of videos from your How to build a website with Umbraco v8 series on YouTube. You mentioned a few times that the strongly typed models weren't available in the Core project, because ModelsBuilder generates the models inside the Web project. And you were sometimes casting to strongly typed models in the views.

It would be nice to point out to people that it's fairly easy to have ModelsBuilder create the models in the Core project, so you can you use strongly typed models in both Core and Web.

~/Web.config

<add key="Umbraco.ModelsBuilder.ModelsMode" value="LiveAppData" />
<add key="Umbraco.ModelsBuilder.ModelsDirectory" value="~/../CleanBlog.Core/Models/Generated" />
<add key="Umbraco.ModelsBuilder.ModelsNamespace" value="CleanBlog.Core.Models.Generated" />
<add key="Umbraco.ModelsBuilder.AcceptUnsafeModelsDirectory" value="true" />

~/Views/Web.config

<add namespace="CleanBlog.Core.Models.Generated" />

Keep up the good work!

creativesuspects avatar Mar 15 '20 14:03 creativesuspects

Nice tip. Thanks

prjseal avatar Mar 15 '20 16:03 prjseal