-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No code generation for Content Type Snippets #42
Comments
Hi @djanjicek , |
Yes, I agree. An interface pattern would suffice.
…On Tue, Nov 14, 2017 at 10:19 Petr Švihlík ***@***.***> wrote:
Hi @djanjicek <https://github.com/djanjicek> ,
content snippets can't exist on their own. They are automatically included
in the Content type API
<https://developer.kenticocloud.com/reference#view-a-content-type> and
therefore in the generated models. Is that sufficient for your scenario?
Or do you see one where you could make use of special content-snippet
models?
Please, bare in mind that a content type can contain more than one content
snippet so it's should be understood as composition rather than
inheritance. (I'm saying that because it's not possible to have multiple
inheritance in C#).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADdnjFc1St4W00WG_yqgCLSiDc3tk5QOks5s2VslgaJpZM4Qc-Pv>
.
|
Yeah, interfaces would work fine. Could you please provide a little more context? I'm trying to understand what's the priority of this feature. Is there any real scenario that's not supported / hard to implement at the moment (while we don't have the interfaces)? Thank you! |
The use-case goes about Model / ViewModel mapping. While interfaces play along with OOP practices, they don't cover the support of codename constants. I was too quick about my previous comment. Basically this rules out this option. I can't say: myViewModel.SomeProperty = ISomeContentTypeSnippet.GetString(ISomeContentTypeSnippet.SomeCodeName); What I would need would be an interface ISomeContentTypeSnippet plus a concrete implementation of the content type inheriting this interface. Then I could use the implementation for codename retrieval and the interface for ViewModel modeling. From an OOP perspective is definitely makes sense of using interfaces. |
Can't you do just What would If you had
why not to access the property by |
Ok, let's start from scratch... There are certain situations where I need to call
I'm not sure whether my example explains it entirely, if not, maybe we can have a skype call. |
aaaah.... i see! |
So my first question would be - why do you use Because, looking at the example you provided, I could simply object that the following code would work fine:
|
Mainly because of |
See my comments below
You can find out the type like this
You can do this:
Or do you specifically want to have an IEnumerable of ContentItems? It's true that you can only cast it one way (ContentItem->Strong Type). |
hi @djanjicek do we still need to discuss this or can it be closed? thanks! |
Hi Petr,
We can close it for now.
Best regards,
Drazen
…On Wed, Jan 10, 2018 at 8:06 PM, Petr Švihlík ***@***.***> wrote:
hi @djanjicek <https://github.com/djanjicek> do we still need to discuss
this or can it be closed? thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADdnjK2nx5FnlSLcudNv4q8wd7-zPmuRks5tJQoagaJpZM4Qc-Pv>
.
|
Just like for usual content types it would be good to have generated classes for content type snippets.
The text was updated successfully, but these errors were encountered: