public GenericContent(Models.Content content, Models.ContentPublication publication)
     : this(content)
 {
     if (publication != null)
     {
         this.ContentSourceTypeId = publication.ContentSourceId;
         this.PublishedDateTime   = publication.PublicationDateTime;
         this.Published           = publication.Published;
         this.Deleted             = publication.Deleted;
     }
 }
 public GenericContent(Models.Content content, Models.ContentPublication publication, IEnumerable <Models.ContentMedata> metadata)
     : this(content, publication)
 {
     if (metadata != null)
     {
         this.Metadata = metadata.ToDictionary(t => t.Key, t => t.Value);
     }
     else
     {
         this.Metadata = new Dictionary <string, string>();
     }
 }
        public Content.IContent GetContent(string contentPath)
        {
            GenericContent result = null;

            string[]       pathParts = contentPath.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
            Models.Content root      = this.repository.GetContents().FirstOrDefault(con => con.Id == SqlIdProvider.Instance.CoreContent.MainCollection);
            foreach (var part in pathParts)
            {
                root = this.repository.GetContents()
                       .Join(this.repository.GetContentCollections()
                             .Where(col => col.ContentOwnerId == root.Id),
                             con => con.Id,
                             col => col.ContentId,
                             (con, col) => con)
                       .FirstOrDefault(con => con.Name == part);

                if (root == null)
                {
                    break;
                }
            }

            if (root != null)
            {
                Models.ContentPublication publication = this.repository.GetContentPublications().FirstOrDefault(pub => pub.ContentId == root.Id);

                IEnumerable <Models.ContentMedata> metadata = null;
                if (publication != null)
                {
                    metadata = this.repository.GetContentMetadatas().Where(met => met.ContentPublicationId == publication.Id);
                }

                result = new GenericContent(root, publication, metadata);
            }
            return(result);
        }