Coder Social home page Coder Social logo

modelsbuilder.original's People

Contributors

nul800sebastiaan avatar shazwazza avatar tcmorris avatar zpqrtbnk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modelsbuilder.original's Issues

Type alias "DocTypeName" has a more than one parent class.

When implementing interfaces, the interfaces have to reside in the same directory as the doctype classes, or the custom tool throws an error:

ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: 
Exception: Response status code does not indicate success (InternalServerError)
{
    "Message":"An error has occurred.",
    "ExceptionMessage":"Type alias "DocTypeName" has a more than one parent class."
}

With an inner exception of:

error CS0246: 
The type or namespace name 'IInterfaceName' could not be found 
(are you missing a using directive or an assembly reference?)

If it can’t find the file to parse, it presumes that the interface is actually a class, and flags the implementing class as having multiple parent classes.

http://blog.tompipe.co.uk/post/Adventures-with-Umbraco-and-ZbuModelsBuilder.aspx

zbu base models?

Example: I have 5 doctypes. All use the same doc type composition.

Is it possible to iterate over a base class and do stuff like:

foreach (baseclass item in items.Where(wow => wow.docTypeCompProperty.Equals("cool")) {

}

Auto-generate models

(proposed by Ken Jacobsen)

Add... "an option to trigger the model building automatically when a document type is saved. I know that’ll cause the website to restart every time you change a document type, but once the initial setup of document types is done on a site, you’ll most likely enter a workflow where you make minor changes to a specific document type and then go generate the models, in order to utilize the changes you just made. So I figure it’d be nice to save the devs the extra roundtrip by automating the code generation."

Thinking about allowing EnableLiveModels when Enable(AppData|AppCode|Dll)Models is on, so that we automatically do what needs to be done without you having to press the button. At your own risks ;-)

Would need some sort of (configurable) timeout though, in order not to re-generate on each Umbraco events but only, say, 1s after the last content type related event.

How do we install the VS Extension and nuget package?

Is there a an extension installer?

I have downloaded the project to build it myself but when i open the project in Visual Studio i get the following error for the Custom Tool project:

Zbu.ModelsBuilder.CustomTool\Zbu.ModelsBuilder.CustomTool.csproj: The application which this project type is based on was not found. Please try this link for further information:

http://msdn.microsoft.com/en-US/vstudio/ff718165

That link doesnt really help.

So im now stuck on the Extension.

Secondly - in the wiki notes for the custom tool it says:

Requires that the Site Integration package is installed, either via NuGet or as an Umbraco package

But ive searched Nuget for this package and come up with nothing.

What is the command for the package manager console to install the said package.

So im stuck on both counts! Apologies if im being thick and missed something completely obvious - but for my 1st project using the factory i hand crafted the models. Now i am starting another and thought id give this a whirl now i understand it all.

I have also watched the uHangout vid but again you didnt show where to actually download/get the package or extension - just what you saw once inside VS.

Be handy to update the docs when you have this info.

Error when upgrading to 2.1.1.

Hello

I originally posted this on the Umbraco Forums (https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/63255-Error-using-ZbuModelsBuilder-211).

Upgraded to 2.1.1. (installed a fresh install on my VS2013 machine - needed to be rebuilt, and upgraded the package on my dev site).
Ran the external program as per the instructions - and the follow occurs.

Any ideas?

ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: Exception: Response status code does not indicate success (InternalServerError)

{"Message":"An error has occurred.","ExceptionMessage":"Common Language Runtime detected an invalid program.","ExceptionType":"System.InvalidProgramException","StackTrace":" at System.Collections.Immutable.SecurePooledObject1.Use[TCaller](TCaller& caller)\r\n at System.Collections.Immutable.SortedInt32KeyNode1.Enumerator.PushLeft(SortedInt32KeyNode1 node)\r\n at System.Collections.Immutable.SortedInt32KeyNode1.Enumerator..ctor(SortedInt32KeyNode1 root)\r\n at System.Collections.Immutable.ImmutableDictionary2.Enumerator..ctor(SortedInt32KeyNode1 root, Builder builder)\r\n at System.Collections.Immutable.ImmutableDictionary2.GetEnumerator()\r\n at System.Collections.Immutable.ImmutableDictionary2.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair2[] array, Int32 arrayIndex)\r\n at System.Linq.Buffer1..ctor(IEnumerable1 source)\r\n at System.Linq.OrderedEnumerable1.<GetEnumerator>d__0.MoveNext()\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n at System.Linq.Buffer1..ctor(IEnumerable1 source)\r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)\r\n at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable1 items)\r\n at Microsoft.CodeAnalysis.CSharp.DeclarationTable.Cache.<>c__DisplayClass0.<_ctor>b__1()\r\n at System.Lazy1.CreateValue()\r\n at System.Lazy1.LazyInitValue()\r\n at Microsoft.CodeAnalysis.CSharp.DeclarationTable.Cache.<_ctor>b__4()\r\n at System.Lazy1.CreateValue()\r\n at System.Lazy1.LazyInitValue()\r\n at System.Lazy1.get_Value()\r\n at Microsoft.CodeAnalysis.CSharp.DeclarationTable.GetMergedReferenceDirectives()\r\n at System.Lazy1.CreateValue()\r\n at System.Lazy1.LazyInitValue()\r\n at Microsoft.CodeAnalysis.CSharp.DeclarationTable.get_ReferenceDirectives()\r\n at Microsoft.CodeAnalysis.CommonReferenceManager2.GetCompilationReferences(TCompilation compilation, DiagnosticBag diagnostics, ImmutableArray1& references, IDictionary2& boundReferenceDirectives, ImmutableArray1& referenceDirectiveLocations)\r\n at Microsoft.CodeAnalysis.CommonReferenceManager2.ResolveMetadataReferences(TCompilation compilation, ImmutableArray1& references, IDictionary2& boundReferenceDirectiveMap, ImmutableArray1& boundReferenceDirectives, ImmutableArray1& assemblies, ImmutableArray1& modules, DiagnosticBag diagnostics)\r\n at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.CreateAndSetSourceAssemblyFullBind(CSharpCompilation compilation)\r\n at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.CreateSourceAssemblyForCompilation(CSharpCompilation compilation)\r\n at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.get_SourceAssembly()\r\n at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDeclaredNamespace(NamespaceDeclarationSyntax declarationSyntax)\r\n at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDeclaredNamespaceOrType(CSharpSyntaxNode declarationSyntax)\r\n at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDeclaredTypeMemberContainer(CSharpSyntaxNode memberDeclaration)\r\n at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDeclaredSymbol(BaseTypeDeclarationSyntax declarationSyntax, CancellationToken cancellationToken)\r\n at Zbu.ModelsBuilder.Building.CodeParser.<>c__DisplayClass8.<Parse>b__0(ClassDeclarationSyntax x)\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n at Zbu.ModelsBuilder.Building.CodeParser.Parse(ParseResult disco, CSharpCompilation compilation, SyntaxTree tree)\r\n at Zbu.ModelsBuilder.Building.CodeParser.Parse(IDictionary2 files, IEnumerable1 referencedAssemblies)\r\n at Zbu.ModelsBuilder.AspNet.ModelsBuilderApiController.GetModels(GetModelsData data)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.b__c(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)"}

ZbuModelsBuilder: at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.EnsureSuccess(HttpResponseMessage result)

at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.GetModels(Dictionary`2 ourFiles, String modelsNamespace)

at Zbu.ModelsBuilder.CustomTool.CustomTool.ZbuModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)

Could not load file or assembly 'System.Collections.Immutable, Version=1.1.33.0

After updating version 2.0.3 to 2.1.0 and updating to th latest VSIX, I'm trying to generate models and get the following message. I noticed that ZbuModelsBuilder set the depencies to 1.1.32.0 but somewhere 1.1.33.0 seems to be referenced...

ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: Exception: Response status code does not indicate success (InternalServerError)
{"Message":"An error has occurred.","ExceptionMessage":"Could not load file or assembly 'System.Collections.Immutable, Version=1.1.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)","ExceptionType":"System.IO.FileLoadException","StackTrace":" at Zbu.ModelsBuilder.Building.CodeParser.Parse(ParseResult disco, CSharpCompilation compilation, SyntaxTree tree)\r\n at Zbu.ModelsBuilder.Building.CodeParser.Parse(IDictionary2 files, IEnumerable1 referencedAssemblies)\r\n at Zbu.ModelsBuilder.AspNet.ModelsBuilderApiController.GetModels(GetModelsData data)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.b__c(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func1 func, CancellationToken cancellationToken)"} ZbuModelsBuilder: at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.EnsureSuccess(HttpResponseMessage result) at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.GetModels(Dictionary2 ourFiles, String modelsNamespace)
at Zbu.ModelsBuilder.CustomTool.CustomTool.ZbuModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)

Using PCM and packages

Hi

My site uses PCM throughout and love it but ive come to install a package - ublogsy to be precise and i've hit a bit of a speedbump.

The base type of all my content pages is Content and i have several properties that i create in this node that makes them available to every page. This is great but ive come to install a package and this obviously isnt using PCM. Now thats not really an issue until i try adding the blog post etc to my templates.

Now because posts, categories etc are not part or my doc structure, and my master page utilises UmbracoViewPage as its type im now stuck with a package that i cant just install and run with.

My solution is to copy the blog post etc doctypes into my structure and it seemd to work but feel like swimming against the tide a little.

So my question is do you think the mistake is having a content type in my master page or something else?

Is moving uBlogsy into my own structure the best way to go here?

What is the best thing to utilise in a master page - its just all my partials etc that run form it utilise the auto passed in model. So id have to change quite a few things that are all in and working - breadcrumbs, menus etc etc...

Just interested in your opinion and to see how i can keep using this feature properly.

Cheers Stephan

Error generating models when a solution file contains solution folders

After upgrading to v2.1.2 from v2.1.1, the ModelsBuilder VSIX is now unable to generate models when a solution file contains solution folders. After looking at the code, I can see that the way projects are iterated through has changed. The following line, specifically the reference to dte.Solution.Projects, loops through every kind of project file. This includes solution folders.

var vsProject = dte.Solution.Projects
    .Cast<EnvDTE.Project>()
    .Select(ToHierarchy)
    .Cast<IVsProject>()
    .FirstOrDefault(x =>
    {
        int iFound;
        x.IsDocumentInProject(inputFilePath, out iFound, pdwPriority, out itemId);
        return iFound != 0 && itemId != 0;
    });

The exception actually occurs on the following line, as when selecting each project via the ToHierarchy() method, solution folders have no file name.

using (var projectReader = XmlReader.Create(project.FileName))

A couple of fixes could be applied. The code could either select projects that do not match the solution folder type guid or a defensive code check could be added to ToHierarchy() to make sure we have something within the FileName property.

Using private fields to store properties, or not ;-)

So we were having a discussion on Twitter about using private fields for properties to store the fetched data:

@kipusoep: How about the performance of the dynamic property getters vs. storing the value in a private field?
@zpqrtbnk: not "dynamic" in C# meaning... So it's fast, no need for private fields
@kipusoep: What if I need to use a property multiple times in my view? It'll have to be fetched X times right?
@zpqrtbnk: somehow but it's inexpensive dictionary lookups... With a lot of caching already...
@kipusoep:Property Value Convertors will have to do work everytime though I guess? If properties get more complex it might be an issue?

Dashboard Error

After installing the umbraco package and setting the appSettings in the web.config this is how the dashboard looks like. Think that's not how it should be...

zbuerror

Feature request: Generate models for Archetype

This is a rather strange feature request and I'm just thinking out loud here, but it would be nice if the models builder couldn't just generate models and properties based on document types, but also on configured Archetype datatypes.

I use Archetype more and more and if an Archetype datatype is added to a document type the models builder generates the following property:

[ImplementPropertyType("slider")]
public ArchetypeModel Slider
{
    get { return this.GetPropertyValue<ArchetypeModel>("slider"); }
}

This is the slider datatype:
slider
This is the slider on a node:
slider2
I always need to overwrite those generated properties in a partal class so it will return the data in a better format.

public partial class Home
{
    [ImplementPropertyType("slider")]
    public IEnumerable<Slider> Slider
    {
        get
        {
            var archetypeModel = this.GetPropertyValue<ArchetypeModel>("slider");
            return archetypeModel.Select(x =>
                {
                    return new Slider()
                    {
                        Title = x.GetValue<string>("title"),
                        Text = x.GetValue<IHtmlString>("text"),
                        Image = x.GetValue<Image>("image")
                    };
                }
            ).ToList();
        }
    }
}
public class Slider
{
    public string Title { get; set; }
    public IHtmlString Text { get; set; }
    public Image Image { get; set; }
}

As you can see I still need to do things like x.GetValue("text") and x.GetValue("image") which are the Archetype equivalent of Model.Content.GetPropertyValue<>("") and it also goes through the Property Editor Value Converters.

So the more I use Archetype the more I still need to programm my own properties while in theory a model could also be generated from the Slider Archetype datatype because it's kind of like a document type. It has datatypes which could be converted to properties on a model.

I wonder if something like this is possible :-).

Override interface properties

If you use the ImplementPropertyType attribute on a partial class the property disappears on the generated partial class because you're writing your own implementation. You can even let your own implementation return a different type.

For the generated interfaces this is currently not supported. I would like to change the type of an interface property that is generated from a composition.

Error when Installing

When Insalling from package installer in U 7.16

I get the following error

image

Please note that it is one of my Surface controllers that is giving the error

As far as I can see the web.config has not been touched

Please advise

Debugging Version Conflict 0.0.0.0 issue

Hi Stephan,

Your ModelsBuilder has been working brilliantly for me for the past few weeks and its an awesome new addition to the Umbraco dev toolkit. Randomly yesterday however, it started failing with the below message:

ZbuModelsBuilder: Starting 23/01/2015 09:19:14.
ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: Exception: Response status code does not indicate success (Forbidden)
"API version conflict: client version (0.0.0.0) is not compatible with server version(2.0.3.34)."
ZbuModelsBuilder: at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.EnsureSuccess(HttpResponseMessage result)
at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.ValidateClientVersion()
at Zbu.ModelsBuilder.CustomTool.CustomTool.ZbuModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)

I looked back over my commits since it failed and I cannot find any reason why this has happened (no new nuget packages, no changes to the config or anything). Anyway I noticed there was an new version (2.0.3) so I updated both the main package and the site integration tool via Nuget. I restarted VS2012 however I continue to get the above API version conflict message. How do I debug this or manually set the client version number?

Thanks, keep up the great work!

Runtime error after upgrading: Could not load file or assembly 'System.Collections.Immutable'

After updating Zbu.ModelsBuilder, Zbu.ModelsBuilder.AspNet and the Visual Studio Extension, I receive the following exception after successfully building an application:

Could not load file or assembly 'System.Collections.Immutable, Version=1.1.22.0' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I've upgrade the following packages and Visual Studio extensions:

  • Zbu.ModelsBuilder to 2.0.2-final
  • Zbu.ModelsBuilder.AspNet to 2.0.2-final
  • Visual Studio Extension to 2.0.2.31

I noticed 2.0.2-final is dependant on Microsoft.Bcl.Immutable but the package has been unlisted from nuget.org. After looking around, it appears to have been moved to System.Collections.Immutable.

I also noticed that after upgrading, my System.Collections.Immutable reference went from Microsoft.Bcl.Immutable.1.1.22-beta to Microsoft.Bcl.Immutable.1.1.20-beta.

Would updating the package reference help fix this issue?

Generator throws error in VS2012

When I try to run the custom tool to generate the models in VS2012 I get the following exception:

ZbuModelsBuilder: Starting 9/12/2014 8:57:52 AM.
ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
ZbuModelsBuilder: at System.Net.Http.Formatting.JsonMediaTypeFormatter..ctor()
at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.ValidateClientVersion()
at Zbu.ModelsBuilder.CustomTool.CustomTool.ZbuModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)

I tried the solution from here, but that also doesn't work: http://stackoverflow.com/questions/16999777/visual-studio-2012-project-not-able-to-load-newtonsoft-json

Is this an issue of the models builder or VS2012?

Issues with dependencies versions

Update System.Web.Mvc to 4.0.0.1, must update binding redirects (in web.config? in NuGet package? in Umbraco package?).
Update Roslyn & dependencies to latest versions, fix binding redirects.

Properties not available on interfaces with Document Type Compositions

I've been testing the Umbraco 7.2 beta with Document Type Compositions. When a Document Type inherits from multiple compositions it creates interfaces for these Document Types so it can inherit from these interfaces.

The properties on these interfaces are generated incorrectly. For example it generates the following:

// Mixin content Type 1204 with alias "Doc1"
/// <summary>Doc1</summary>
public partial interface IDoc1 : IPublishedContent
{
    /// <summary>Text1</summary>        string Text1 { get; }
}

/// <summary>Doc1</summary>
[PublishedContentModel("Doc1")]
public partial class Doc1 : PublishedContentModel, IDoc1

The Text1 property is on the same line as the summary and commented out because of that. If it's on a new line it works correctly.

The rest already works perfect. For example you can do something like this to get all the nodes that have a certain composition.

var docs = CurrentPage.Children<IDoc1>();

Error when running custom ver. 2.0.3.34.

I download Hybrid Framework for Umbraco v7 Clean from https://github.com/jbreuer/Hybrid-Framework-for-Umbraco-v7-Clean.
In Umbraco.Site and Umbraco.Extensions projects in solution I update Zbu.ModelsBuilder and Zbu.ModelsBuilder.AspNet to version 2.0.3-final.
Then I install ZpqrtBnk Umbraco ModelsBuilder ver. 2.0.3.34.
When I run tool in Visual Studio 2012 or 2013 I got output:

ZbuModelsBuilder: Starting 2015-01-13 23:25:02.
ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: AggregateException: One or more errors occurred.
ZbuModelsBuilder: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.ValidateClientVersion()
at Zbu.ModelsBuilder.CustomTool.CustomTool.ZbuModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)
ZbuModelsBuilder: Inner: JsonSerializationException: Error getting value from 'ZERO_CHAR_VALUE' on 'System.Version'.
ZbuModelsBuilder: at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value)
at System.Net.Http.Formatting.JsonMediaTypeFormatter.<>c__DisplayClassd.b__c()
at System.Threading.Tasks.TaskHelpers.RunSynchronously(Action action, CancellationToken token)
ZbuModelsBuilder: Inner: NotSupportedException: Specified method is not supported.
ZbuModelsBuilder: at System.Reflection.MdFieldInfo.get_FieldHandle()
at System.Reflection.Emit.DynamicILGenerator.GetTokenFor(RuntimeFieldInfo runtimeField, RuntimeType rtType)
at System.Reflection.Emit.DynamicILGenerator.Emit(OpCode opcode, FieldInfo field)
at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.GenerateCreateGetFieldIL(FieldInfo fieldInfo, ILGenerator generator)
at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateGet[T](FieldInfo fieldInfo)
at Newtonsoft.Json.Utilities.ReflectionDelegateFactory.CreateGet[T](MemberInfo memberInfo)
at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
ZbuModelsBuilder: AggregateInner: JsonSerializationException: Error getting value from 'ZERO_CHAR_VALUE' on 'System.Version'.
ZbuModelsBuilder: at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value)
at System.Net.Http.Formatting.JsonMediaTypeFormatter.<>c__DisplayClassd.b__c()
at System.Threading.Tasks.TaskHelpers.RunSynchronously(Action action, CancellationToken token)

Do I have to use IgnorePropertyType instead of ImplementPropertyType to implement my own logic?

I have my generated models living in the folder \Models\Generated. In there I have my ContentModelBuilder.cs setup to use the custom tool ZbuModelsBuilder, and set the Namespace to MyProject.Umbraco.Web.Models. So far so good.

However, I have an issue when I want to override certain properties in partial classes as it seems that I have to put all the attribute decorations in my ContentModelBuilder.cs class. To avoid having the property defined in the Xyz.generated.cs and Xyz.partial.cs I need to first ignore the property in the ContentModelBuilder.cs and then implement it in the Xyz.partial cs.
I expected that when I could decorate the properties I want to imlement myself with the [ImplementPropertyType] attributes in my Xyz.partial.cs class. And probably also the [RenameContentType] attribute, but I can live with this.

Note that to avoid that the naming of my contentmodels collides with other models or classes, I suffix all my contentmodels with ...ContentModel, hence the RenameContentType.

[ContentModelBuilder.cs]

[assembly: RenameContentType("Xyz", "XyzContentModel")]
namespace MyProject.Umbraco.Web.Models
{
    [IgnorePropertyType("whatever")] //<-- I have to put this here in the ContentModelBuilder
    public partial class XyzContentModel { }
}
[Xyz.partial.cs]

namespace MyProject.Umbraco.Web.Models
{
    public partial class XyzContentModel
    {
        [ImplementPropertyType("whatever")] //<-- As this is not enough...?
        public RJP.MultiUrlPicker.Models.Link Whatever
        {
            get 
            { 
                return this.GetPropertyValue<string>("whatever");
            }
        }
    }
}

Is this behavior as intended, or am I just missing something obvious?

Serializing models

Hi

I'm trying to serialize a model to be used in angular.

Unfortunately I get a "Self referencing loop detected" error

    var _home = Umbraco.Content(id);
    Home hhh = new Home(_home);
     JsonSerializerSettings jss = new JsonSerializerSettings();
     jss.Formatting = Newtonsoft.Json.Formatting.Indented;
     jss.NullValueHandling = NullValueHandling.Ignore;
     jss.StringEscapeHandling = StringEscapeHandling.EscapeNonAscii;
     jss.TypeNameHandling = TypeNameHandling.Objects;
     jss.ReferenceLoopHandling = ReferenceLoopHandling.Error; //  if I change this to ignore or serilize I get a stack overflow.
    return JsonConvert.SerializeObject (hhh,jss);

Am I going about this the correct way or should I be serializing some other way

Thanks

Error: Already referencing a newer version of 'Microsoft.Bcl.Immutable'.

Installed I have:

Zbu.ModelsBuilder to 2.0.0-final (Prerelease)
Zbu.ModelsBuilder.AspNet to 2.0.0-final (Prerelease)
Visual Studio Extension for Windows Lib... v1.0.9200
ZpqrtBnk Umbraco ModelsBuilder Custom Tool 2.0.2.31

I'm trying to update the nuget Zbu.ModelsBuilder packages to 2.0.2 but I just get the following error.
Error: Already referencing a newer version of 'Microsoft.Bcl.Immutable'.

My installed Microsoft.Bcl.Immutable package version is 1.1.22-beta.

immutable

Custom base class not working

When you have a partial class and you want to give that partial class it's own base class it's currently not supported.

For example:

Generated class:
public partial class ProductDetails : Base, IHeader

Custom partial class:
public partial class ProductDetails : HeaderCompostion

HeaderCompostion class (only here for clarification)
public class HeaderCompostion : Base, IHeader

So in this case it would be nice if the generated class wouldn't have the base class because that's already defined in the partial class.

Currently getting this error when I try the above:
ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: Exception: Response status code does not indicate success (InternalServerError)
{"Message":"An error has occurred.","ExceptionMessage":"Type alias "ProductDetails" has a more than one parent class.","ExceptionType":"System.InvalidOperationException","StackTrace":" at Zbu.ModelsBuilder.Building.Builder.Prepare()\r\n at Zbu.ModelsBuilder.Building.Builder..ctor(IList1 typeModels, ParseResult parseResult, String modelsNamespace)\r\n at Zbu.ModelsBuilder.AspNet.ModelsBuilderApiController.GetModels(GetModelsData data)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func1 func, CancellationToken cancellationToken)"}
ZbuModelsBuilder: at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.EnsureSuccess(HttpResponseMessage result)
at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.GetModels(Dictionary`2 ourFiles, String modelsNamespace)
at Zbu.ModelsBuilder.CustomTool.CustomTool.ZbuModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)

(beta8) True live models do not work

True live models do not work in beta8. Switched over to using the Roslyn compiler for true live models, turns our it's not a good idea. Will revert to the old way in beta9.

Question regarding 6 and 7

Hi

I was under the impression that umbraco v6 and v7 are the same except for the new backend.

So is it possible that the models builder will work for Visual Studio?

Thanks

Cannot rebuild the VSIX package

Getting error VSSDK1031 - "Extension '' could not be found. Please make sure the extension has been installed." Not sure anything has changed in the project file, really. Can fix by editing the project propertiex, VSIX tab, and unchecking "Deploy VSIX content to experimental instance for debugging". But?

Utilizing custom code for DocType Compositions?

A question about your thoughts for properly utilizing the generated code for Doctype "Compositions/mixins".

Basic Master/Child DocTypes Relationship

If we have a simple Master > Child doctype relationship, ModelsBuilder creates a class for each, and the child inherits the master - this makes sense.

public partial class MasterDocument : PublishedContentModel {...}

public partial class ChildDocument : MasterDocument {...}

And, if we implement custom property handling in the customized partial for the "master" class, those enhancements are immediately and automatically available to the child doctype class. If we change the implementation of those customized properties, we just change them in that one place - the master class.

Compositions in DocTypes

When using the "Compositions" (AKA "Mix-ins"), ModelsBuilder generates an interface representing the Composition as well as a class implementing that interface:

public partial interface IMyComposition : IPublishedContent {...}

public partial class MyComposition : PublishedContentModel, IMyComposition {...}

Since "Compositions" are only top-level doctypes (meaning, not a child of another doctype), and thus could also be used as a doctype in their own right on a Content node, they do need their own class in the model.

When the classes are generated for a Doctype which uses a composition, the class implements the interface of the composition:

public partial class ChildDocument : MasterDocument, IMyComposition {...}

My question is: How should customized properties for a Composition be accessed by those Doctypes which implement the composition interface?

My initial thought was that the custom properties would be defined in the Composition class, then "called" from the custom code partials for any implementing Doctypes.

Example of custom property on MyComposition:

public partial interface IMyComposition
{
    IEnumerable<IPublishedContent> SelectedNodes { get; }
}

public partial class MyComposition
{
    public IEnumerable<IPublishedContent> SelectedNodes
    {
        get
        {
            //assuming that there is a MNTP property on the MyComposition doctype named "mntpSelected"...
            var selectedNodes = ...code to get an IEnum of the nodes from the property "mntpSelected"... ;
            return selectedNodes;
        }
    }

Example of implementing:

public partial class ChildDocument
{
    public IEnumerable<IPublishedContent> SelectedNodes
    {
        get
        {
            var myComp = new MyComposition(this);
            return myComp.SelectedNodes;
        }
    }
}

But in practice, when calling the property, even if the underlying MNTP data exists, the custom property returns NULL.

@inherits UmbracoViewPage<BaseModel<ChildDocument>>

@Model.Content.mntpSelected <-- This has the CSV of node IDs as expected...
@Model.Content.SelectedNodes <-- This is always Null

I had assumed that the current actual IPublishedContent would be used to evaluate the custom properties, but that doesn't seem to be the case.

Can you suggest a strategy to utilize custom properties related to a Composition? Ideally, there would only be one location for the logic to be defined, in the interests of future maintainability.

2.0.0 / 2.0.1 VSIX compatibility issues

At the moment, the situation is:

  • VSIX 2.0.0 to site 2.0.0 - works
  • VSIX 2.0.0 to site 2.0.1 (ie you upgraded the site) - works
  • VSIX 2.0.1 to site 2.0.1 (ie you upgraded both) - should work, must test
  • VSIX 2.0.1 to site 2.0.0 (ie you upgraded the VSIX) - does not work

Generate models in a DLL

(proposed by Ken Jacobsen)

Add... "an option to generate a DLL instead of code files in App_Code, so the server doesn’t have to recompile the code files on start-up. The DLL should probably be named after the model namespace, [Zbu.ModelsBuilder.ModelsNamespace].dll".

Would be a new config option EnableDllModels that would cause files to be generated in AppData (so you can merge your own files/partials there), and then compiled to a DLL.

Be handy to be able to set a type on a property

So that we don't have object - on a content picker for example we could set int for the node id.

Or would it be better to just implement the property ourselves and ask the Builder to ignore? I guess if we did it ourselves then we can go the extra mile and spin up a proper type.

Missing reference DLL when generating DLL

Hi!

ModelsBuilder 2.0.2 (installed from the Our package) seems to be missing a referenced DLL (Microsoft.CodeAnalysis.Desktop, Version=0.7.0.0). The installer did warn me about this reference issue, and surely - when I attempt to use the ModelsBuilder to build a DLL, it fails with this error:

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.CodeAnalysis.Desktop, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Zbu.ModelsBuilder.Building.Compiler.GetCompilation(String assemblyName, IDictionary2 files, SyntaxTree[]& trees) at Zbu.ModelsBuilder.Building.CodeParser.Parse(IDictionary2 files, IEnumerable`1 referencedAssemblies)
at Zbu.ModelsBuilder.AspNet.ModelsBuilderApiController.GenerateModels(String appData, String bin)
at Zbu.ModelsBuilder.AspNet.ModelsBuilderApiController.BuildModels()

I've tried installing Microsoft.CodeAnalysis from NuGet without luck (possibly because the current NuGet version of Microsoft.CodeAnalysis.Desktop.dll is 1.0.0.41031).

Any advice?

ModelPropertyAliasAttribute is redundant

ModelPropertyAliasAttribute is used in the generated code to indicate the alias of the generated property, and allow us to write things such as

MyContentType.GetModelPropertyType(x => x.MyProperty);

and obtain the PublishedPropertyType for the property. However it is redundant with ImplementPropertyTypeAttribute which we should also use in generated code.

We probably have the same issue with ImplementContentTypeAttribute vs. Umbraco's built-in PublishedContentModelAttribute -- but that would require a breaking change in Umbraco?

Compositions makes trouble

Im using Umb 7.21 and latest zbu.Modelsbuilder. Ive added a composition ("Pages") to my document type "TextPage".

It seems that it breaks TextPage as it cant find IPages.

As a result only the other Doctypes work.

Modelsbuilder is setup to build to AppCode. I'm building using Umbraco Dashboard.

The project is a "Website project" which is set not to build in VS so this should be the same as if it was running on any host right?

Any clues?

Panic when generating classes outside of the current project

Using the Visual Studio extension.

Get panic error (listed below) if the project selected in Solution Explorer is different to the one containing your ModelsBuilder.cs (file with custom tool configured).

  1. Have models in Site.Core, Umbraco in Site.Web
  2. Open ModelsBuilder.cs (with custom tool configured)
  3. Select the Site.Web project in Solution Explorer
  4. Click on text editor for ModelsBuilder.cs, save file

Get the following error

ZbuModelsBuilder: Starting v2.1.1.38 15/04/2015 16:44:59.
ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: Exception: Panic: source file not found in project.
ZbuModelsBuilder:    at Zbu.ModelsBuilder.CustomTool.VisualStudio.VisualStudioHelper.GetSourceItem(String inputFilePath)
   at Zbu.ModelsBuilder.CustomTool.CustomTool.ZbuModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)

My actual workflow is this, using Resharper:

  1. Open ModelsBuilder.cs with Resharper "Navigate To"
  2. Save file
  3. Get "Panic" error

To work around the issue, I have to ensure that the "current project" (in Solution Explorer) is my Core project, then save/run custom tool (I use shift+alt+L, ESC as a nifty shortcut to do this)

Error when running custom build tool

Just having teething problems getting this project set up. I have a separate class library for the models that I have the Umbraco Core Binaries and ModelsBuilder library installed via NuGet to. I set up the custom tool options but when I run I get this error:

ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: FileNotFoundException: Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Not sure why, I can see System.Web.Http (v4) is present as a reference in the project.

Insights much appreciated!

Alan

Error when installing on UaaS

When installing the package on UaaS it throws an error after installation.
That System.Object is in a non referenced Assembly.

Image attached but in german.

zbu error

Not a issue..

But i'm trying to build the same. Only difference is that i build a complete ORM with it. The load (with relations) and save is already finished, take a look at https://github.com/W3S-uORM/uORM.

Now i'm trying to build a object generator but i can't find the right type out the DataTypeService. How did you fix that?

Error when running from Visual Studio

Hi,

When running the builder (2.0.3) with Visual Studio I get the following error:

ZbuModelsBuilder: Starting 28-1-2015 13:33:58.
ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: AggregateException: One or more errors occurred.
ZbuModelsBuilder: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.ValidateClientVersion()
at Zbu.ModelsBuilder.CustomTool.CustomTool.ZbuModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)
ZbuModelsBuilder: Inner: JsonSerializationException: Error getting value from 'SeparatorsArray' on 'System.Version'.
ZbuModelsBuilder: at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value)
at System.Net.Http.Formatting.JsonMediaTypeFormatter.<>c__DisplayClassd.b__c()
at System.Threading.Tasks.TaskHelpers.RunSynchronously(Action action, CancellationToken token)
ZbuModelsBuilder: Inner: InvalidProgramException: Common Language Runtime detected an invalid program.
ZbuModelsBuilder: at GetSeparatorsArray(Object )
at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
ZbuModelsBuilder: AggregateInner: JsonSerializationException: Error getting value from 'SeparatorsArray' on 'System.Version'.
ZbuModelsBuilder: at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value)
at System.Net.Http.Formatting.JsonMediaTypeFormatter.<>c__DisplayClassd.b__c()
at System.Threading.Tasks.TaskHelpers.RunSynchronously(Action action, CancellationToken token)
ZbuModelsBuilder: Starting 28-1-2015 13:34:12.
ZbuModelsBuilder: ZbuModelsBuilder failed to generate code: AggregateException: One or more errors occurred.
ZbuModelsBuilder: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
at Zbu.ModelsBuilder.AspNet.ModelsBuilderApi.ValidateClientVersion()
at Zbu.ModelsBuilder.CustomTool.CustomTool.ZbuModelsBuilder.GenerateRaw(String wszInputFilePath, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, String& errMsg)
ZbuModelsBuilder: Inner: JsonSerializationException: Error getting value from 'SeparatorsArray' on 'System.Version'.
ZbuModelsBuilder: at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value)
at System.Net.Http.Formatting.JsonMediaTypeFormatter.<>c__DisplayClassd.b__c()
at System.Threading.Tasks.TaskHelpers.RunSynchronously(Action action, CancellationToken token)
ZbuModelsBuilder: Inner: InvalidProgramException: Common Language Runtime detected an invalid program.
ZbuModelsBuilder: at GetSeparatorsArray(Object )
at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
ZbuModelsBuilder: AggregateInner: JsonSerializationException: Error getting value from 'SeparatorsArray' on 'System.Version'.
ZbuModelsBuilder: at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value)
at System.Net.Http.Formatting.JsonMediaTypeFormatter.<>c__DisplayClassd.b__c()
at System.Threading.Tasks.TaskHelpers.RunSynchronously(Action action, CancellationToken token)

return Image model not string gives me null

Hi,

I have models generated. I amend MediaPicker property from string to Image (auto-generated model), but it gives me null.

        [ImplementPropertyType("newsThumbnail")]
        public Image NewsThumbnail
        {
            get { return this.GetPropertyValue<Image>("newsThumbnail"); }
        }

As seen here: #13
this technique is used with Grid and it works.
Is this not working with media picker or am I missing something?

AppCode vs AppData

Good Morning

I have set up my web config to have the following
add key="Zbu.ModelsBuilder.EnableAppCodeModels" value="true"
add key="Zbu.ModelsBuilder.EnableAppDataModels " value="false"
add key="Zbu.ModelsBuilder.ModelsNamespace" value="MyModels"

But when I run the models builder it places the generated.cs files in the AppData folder

Is this correct ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.