sblog.net icon indicating copy to clipboard operation
sblog.net copied to clipboard

more robust post entity

Open nmolzach opened this issue 11 years ago • 2 comments

hello, just a suggestion as i am going to try my hand at implementing this myself. but i think a more robust post entity would be nice and allow alternate layouts depending on what sort of stuff was attached to the post. i.e. specifically, a table for files associated with the post.

with that, you could create downloadable assets associated with the post, add banner graphics to a post, and also have an easy way to embed videos associated with the post.

Something like the following:

on the post:



public List<AttachmentEntity> Attachments { get; set; }

namespace sBlog.Net.Domain.Entities
{
    [Table(Name = "Attachments")]
    public class AttachmentEntity
    {
        [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
        public int AttachmentId { get; set; }
        [Column] 
        public int PostID { get; set; }
        [Column] 
        public string AttachmentName { get; set; }
        [Column]
        public string AttachmentType { get; set; }
        [Column]
        public string AttachmentPath { get; set; }
        [Column]
        public PostContextType PostContext { get; set; } 
    }

    public enum PostContextType //context of the post, is this for a banner?  a main content video?  downloadable asset?
    {
        Video,
        Banner,
        Downloadable
    }
}

Also, you could store the entire file in the db as a byte array and decode the context on the other side for secured files...

nmolzach avatar Jan 27 '14 03:01 nmolzach

also, if this is not the place for this stuff, i'll post where it should be if you let me know where :)

nmolzach avatar Jan 27 '14 03:01 nmolzach

Hello Zach,

This is an excellent idea!!! Feel free to give a pull request and I will check and merge it w/ the master branch (if you're interested)! Initially when I was designing the attachments part I thought about this, but since one attachment could be used across multiple posts I wanted to avoid that complexity, I ignored this at that point, to get the project released :). But this would definitely be a value add now! If you're interested let me know!

karthik25 avatar Jan 27 '14 16:01 karthik25