Great post Sean, thanks for explaining in detail.
In your Sandbox.Core, how would you represent data such as PageAttachment. We use BasePageData for all other "Page" things such as NodeId, Guid, etc. including IList where PageAttachment class has a property of Kentico.Content.Web.Mvc.IPageAttachmentUrl. Do you have any tips on how to set it up in core without referencing Kentico libs?
Thanks
Lead Product Evangelist @Kentico, Founding partner @craftbrewingbiz. love to learn / teach web dev & software engineering, collecting vinyl records, mowing my lawn, craft 🍺
I handle page attachments and media library files the same way I handle Page Type data.
I create POCO class that represents the minimum about of information the presentation layer needs about that object and project the *Info type into it within my data access layer.
I typically have a ImageContent type and a MediaContent type. These have the Guid and ID fields of the database objects they represent and other important values like URLs and Labels. Images have width/height properties.
But the key part is that I'm returning a limited set of values and only working with the Kentico types in the data access implementation methods.
This makes my caching slimmer and allows me to adjust my data access implementation more easily (returning an AttachmentInfo makes it hard to return additional metadata from an external system, for example).
Specially to your question, the IPageAttachmentUrl are resolved and turned into a string URL property on my MediaContent type in the data access implementation.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great post Sean, thanks for explaining in detail.
In your Sandbox.Core, how would you represent data such as PageAttachment. We use BasePageData for all other "Page" things such as NodeId, Guid, etc. including IList where PageAttachment class has a property of Kentico.Content.Web.Mvc.IPageAttachmentUrl. Do you have any tips on how to set it up in core without referencing Kentico libs?
Thanks
I handle page attachments and media library files the same way I handle Page Type data.
I create POCO class that represents the minimum about of information the presentation layer needs about that object and project the
*Infotype into it within my data access layer.I typically have a
ImageContenttype and aMediaContenttype. These have theGuidand ID fields of the database objects they represent and other important values like URLs and Labels. Images have width/height properties.But the key part is that I'm returning a limited set of values and only working with the Kentico types in the data access implementation methods.
This makes my caching slimmer and allows me to adjust my data access implementation more easily (returning an
AttachmentInfomakes it hard to return additional metadata from an external system, for example).Specially to your question, the
IPageAttachmentUrlare resolved and turned into a stringURLproperty on myMediaContenttype in the data access implementation.