Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Phill 115 posts 288 karma points
    Feb 01, 2016 @ 14:14
    Phill
    0

    Hybrid Framework with version 7.4?

    Has anyone tried to work with the Hybrid Framework for V7 with the new 7.4 Beta 2? I'm doing some early testing for an upcoming project and am struggling to get things to play well together. As you know, ModelsBuilder is built into the Core and it now automatically generates a set of Models under App_Data. This of course doesn't play well if you want to have your models in a separate class file.

    I've tried taking the generated models from App_Data and copying them over to my Models class library, changing the namespace so there's no conflict but when I use the following:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<MyProject.Models.MasterModel<MMyProject.Models.Generated.HomePage>>
    

    I get this error:

    Error: The model item passed into the dictionary is of type 'MyProject.Models.MasterModel`1[Umbraco.Web.PublishedContentModels.HomePage]', but this dictionary requires a model item of type 'MyProject.Models.MasterModel`1[MyProject.Models.Generated.HomePage]'.
    

    It seems that even though I'm passing in MasterModel<MyModel> it still thinks I'm passing MasterModel<V7.4GeneratedPublishedContentModels>

    If I use the following (uses the v7.4 generated model from App_Data as the type parameter):

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<MyProject.Models.MasterModel<HomePage>>
    

    The page displays correctly with the above code, but I'm not able to use my public partial class HomePage to add additional fields to the model.

    I really like the Hybrid Framework but with 7.4 release just around the corner I don't want to start a project on 7.3 with the Hybrid Framework in place and then not be able to ever upgrade or of the upgrade to be a major overhaul.

    Maybe there's something simple I'm missing to getting this work? Any insight would be greatly appreciated.

    Thanks in advance. Phill

  • Phill 115 posts 288 karma points
    Feb 05, 2016 @ 15:47
    Phill
    0

    Bueller? Just a bump on this one since 7.4 just hit RC status and I'm going to have to decide soon if I scratch Hybrid Framework on not. Maybe this is a question best posted on Models Builder and how to change the now Core ModelsBuilder from generating in the App_Data folder to generating as part of a class library. Or do I maybe stick with Hybrid Framework and try to rip out the built in Models Builder of 7.4 and not use it at all?

    Again, any help here would be greatly appreciated. Phill

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 05, 2016 @ 15:51
    Jeroen Breuer
    0

    Hello,

    I haven't tried the Hybrid Framework with Umbraco 7.4. For a quick upgrade you could keep using the old Models Builder. You can disable the one shipped with Umbraco by changing this app setting:

    <add key="Umbraco.ModelsBuilder.Enable" value="false" />
    

    Jeroen

  • Phill 115 posts 288 karma points
    Feb 05, 2016 @ 22:37
    Phill
    0

    Hi Jeroen,

    Thanks for the response (and thanks for HF!). I want to mark your post as the solution as this is what I'm now doing to get things to work, but I think I will leave it open for now. Maybe in a few weeks, when 7.4 has been released I'll bring the topic up again. I'm sure the team is more than busy just trying to get 7.4 released that there's not time for integration/expanding at the moment.

    Thanks again. Phill

  • Iain Martin 54 posts 98 karma points
    Feb 05, 2016 @ 19:19
    Iain Martin
    0

    I've been playing with Release Candidate this evening and can't seem to get it to actually build the models. or if it is I have no idea where they are.

    These are the settings that I have in my web.config file:

    <add key="Umbraco.ModelsBuilder.Enable" value="true" />
    <add key="Umbraco.ModelsBuilder.ModelsMode" value="AppData" />
    <add key="Umbraco.ModelsBuilder.EnableApi" value="true"/>
    

    I have changed the ModelsMode from PureLive to AppData to see if the models were saved in the App_Data/Models folder.

    I also use Hybrid Framework in all my projects and love the fact that I can separate out all my business logic from the presentation layer in two projects so I'm keen to get HF working for 7.4

    The download that I'm using is purely the download of Umbraco from the releases page, no packages are installed or any additional items installed - simple download, extract and run.

    Anybody willing to give me some pointers here?

    Cheers, Iain

    EDIT: Okay, kind of going round in circles here.

    Got the model file to generate - good. Can't get to the Model.Content.

    Compile and it bursts with the error that this file exists in two places : ~/AppWebmodels.generated.cs.8f9494c4.hlj82l5s.dll' and '~/Umbraco74.DLL'

    Any ideas?

  • Phill 115 posts 288 karma points
    Feb 05, 2016 @ 21:29
    Phill
    0

    Hi Iain,

    This is exactly what I was going through. As Jeroen has recommended, I've set the new Umbraco.ModelsBuilder to false (and deleted the generated.cs file from App_Data) and am back to using the old Zbu.ModlesBuilder and VS Extension in my Class library.

    The only way I can see this working is if the new Umbraco.ModelsBuilder gets updated to allow for a "Class Library" type of parameter where you can point your models to be built to.

    I spent a lot of time trying different ways to get this to work and couldn't figure it out (admittedly it's either beyond my ability to do so or it's just not possible.)

    That said, I can say the option of using the older 2.0 of ModelsBuilder like HF does works fine with 7.4 RC1. I haven't encountered any issues so far.

    Hopefully ModelsBuilder gets an updated VS Extension and we can at least be using the same lib across the board.

    Hope that helps. Phill

  • Iain Martin 54 posts 98 karma points
    Feb 06, 2016 @ 11:16
    Iain Martin
    0

    I'm kind of struggling then to really see the point of ModelsBuilder embedded in to Umbraco if you can't actually use the models that it builds in your templates, unless there is more to come from ModelBuilder and the Core Umbraco team for the full version of V7.4.

    Also, because the models.generated is in the App_Data folder, VS won't allow you to create a class or anything else in there unless it's data related, so I don't get why the models are being generated there?

    I've had a trawl through the release notes and the blog and see that Seb is going to do another blog about the ModelBuilder integration, so hopefully he'll shed a bit more light on it at that point. With 5% still to go on the release, then there is obviously some work still to be done on this.

    The inclusion of models in the core is great and well done to the team for actually bringing it in to the core release, but there are obviously still some issues to sort out before we get to the full version.

Please Sign in or register to post replies

Write your reply to:

Draft