Fixed issue with models builder

Signed-off-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Bjarke Berg
2020-09-23 14:22:53 +02:00
parent 435cf2623a
commit acc7065fa1
4 changed files with 4 additions and 6 deletions

View File

@@ -24,14 +24,13 @@ namespace Umbraco.ModelsBuilder.Embedded.Compose
composition.RegisterUnique<OutOfDateModelsStatus>();
composition.RegisterUnique<ModelsGenerationError>();
composition.RegisterUnique<PureLiveModelFactory>();
composition.RegisterUnique<IPublishedModelFactory>(factory =>
{
var config = factory.GetInstance<IOptions<ModelsBuilderSettings>>().Value;
if (config.ModelsMode == ModelsMode.PureLive)
{
composition.RegisterUnique<IPublishedModelFactory, PureLiveModelFactory>();
return factory.GetInstance<PureLiveModelFactory>();
// the following would add @using statement in every view so user's don't
// have to do it - however, then noone understands where the @using statement
// comes from, and it cannot be avoided / removed --- DISABLED

View File

@@ -66,8 +66,8 @@
"EnableTours": true
},
"ModelsBuilder": {
"ModelsMode": "Nothing",
"Enable": "true"
"ModelsMode": "PureLive",
"Enable": false
}
}
}

View File

@@ -230,7 +230,6 @@
<Compile Include="Mvc\FilteredControllerFactoryCollectionBuilder.cs" />
<Compile Include="Mvc\SurfaceControllerTypeCollection.cs" />
<Compile Include="PublishedElementExtensions.cs" />
<Compile Include="PublishedModels\DummyClassSoThatPublishedModelsNamespaceExists.cs" />
<Compile Include="Security\AuthenticationExtensions.cs" />
<Compile Include="Security\UmbracoSecureDataFormat.cs" />
<Compile Include="Security\UmbracoAuthTicketDataProtector.cs" />