Skip to content
This repository was archived by the owner on Jun 18, 2018. It is now read-only.

Conversation

@cwjackso
Copy link

No description provided.

@leekelleher leekelleher self-assigned this Feb 17, 2016
@leekelleher leekelleher added this to the 0.3.0 milestone Feb 17, 2016
@mattbrailsford
Copy link
Collaborator

Guess this means single item mode won't work properly then as our resolver can resolve multiple value types.

@leekelleher
Copy link
Collaborator

@zpqrtbnk Can you offer any advice on how we could handle multiple value types?

e.g. our ValueConverter could return either an IEnumerable<IPublishedContent> or a single IPublishedContent

@cwjackso
Copy link
Author

I imagine two property value converters would be needed. However the "IsConverter" method has no context of value so it could not be done at run time.

I suppose it opens the discussion into if a single property editor should be returning two different types though. Its easy in code to .FirstOrDefault() if you know there is only going to be one. but that's a breaking change now.

@mattbrailsford
Copy link
Collaborator

mattbrailsford commented Feb 17, 2016 via email

@cwjackso
Copy link
Author

@mattbrailsford it may be possible just looking at the converter actually.

the single return works on min/max item pre-values so splitting the converter in two should be possible. I have 30 mins if you want me to look at another pull request?

@mattbrailsford
Copy link
Collaborator

mattbrailsford commented Feb 17, 2016 via email

@leekelleher
Copy link
Collaborator

@cwjackso By all means, please do 😎

…n items are set to 1. Also added 3 static extensions to PublishedPropertyType to stay DRY
@cwjackso
Copy link
Author

Ok, that works nicely! I've pulled some logic out into static extensions but thought that would be cleaner than extending the converter?

Thanks

@mattbrailsford
Copy link
Collaborator

Have you tested it in non-models builder manner? ie, from within a normal view can you still do Model.GetPropertyValue< IEnumerable< IPublishedContent>>("alias") and Model.GetPropertyValue< IPublishedContent>("alias")

@leekelleher
Copy link
Collaborator

@mattbrailsford I think they should be okay, as GetPropertyValue extension method is a wrapper for GetProperty("alias").Value.TryConvertTo<T> (obviously that's "in a nutshell" 😉) ... so the PVC returns the appropriate object-type and TryConvertTo<T> attempts to cast/convert it accordingly.

(Sorry if I'm teaching you to suck eggs 😊)

@leekelleher
Copy link
Collaborator

@cwjackso Good work, we'll review as soon as we can.

@mattbrailsford
Copy link
Collaborator

It's cool, I'm just throwing things out there as they come to mind, not really with any backing :)

@mattbrailsford
Copy link
Collaborator

Nice work @cwjackso though on such a fast fix

@cwjackso
Copy link
Author

Like a fool I only tested the model building and hadn't tested the retrieval at all. I wasn't returning the converted value in either converter!

The last commit is now tested for retrieval via both strong typed model and .GetPrpertyValue(). As @leekelleher says they are essentially the same thing though.

Thanks

@mattbrailsford
Copy link
Collaborator

Never hurts to double check :) Nice work fella 👏

mattbrailsford added a commit that referenced this pull request Feb 18, 2016
Add PropertyValueType attribute to help models builder #49
@mattbrailsford mattbrailsford merged commit 53c8dd1 into umco:develop Feb 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

3 participants