상속: Entity
예제 #1
0
        private void Store(MarkdownFile file)
        {
            try
            {
                var s = _session.Value;
                using (var tx = s.BeginTransaction())
                {
                    var chosenTags = ChosenTags(file, s);
                    var c = new Content
                    {
                        IsMarkdown = true,
                        Published = true,
                        Created = file.Publish.HasValue ? file.Publish.Value : DateTime.UtcNow,
                        Title = file.Title
                    };

                    c.SetBody(file.PostBody);

                    chosenTags.ForEach(c.AssociateWithTag);

                    s.Save(c);
                    tx.Commit();
                    file.HasBeenStoredLocally = true;
                }
            }
            catch (Exception)
            {
                // What could we sensibly do?
            }
        }
예제 #2
0
파일: ContentVM.cs 프로젝트: flq/Rf.Sites
 private void MapData(Content content)
 {
     MainData(content);
     SetTimeInfo(content);
     HandleAttachments(content);
     
     Tags = content.Tags != null ? content.Tags.Select(t => t.Name) : new string[] { };
 }
예제 #3
0
파일: ContentVM.cs 프로젝트: flq/Rf.Sites
        private void MainData(Content content)
        {
            ContentId = content.Id.ToString();
            Title = content.Title;
            Body = content.IsMarkdown.HasValue && (bool)content.IsMarkdown ? 
                new MarkdownTransformer(content.Body) :
                content.Body;

            new CodeHighlightExtension().Inspect(this);

            Keywords = content.MetaKeyWords;
        }
예제 #4
0
파일: EntityMaker.cs 프로젝트: flq/Rf.Sites
        public Content CreateContent(int id, string title, DateTime created)
        {
            var content = new Content(id)
                            {
                                Title = title,
                                Published = true,
                                Created = created
                            };

            content.SetBody("Body");
            return content;
        }
예제 #5
0
파일: ContentVM.cs 프로젝트: flq/Rf.Sites
        public ContentVM(
          Content content,
          SiteSettings siteSettings, 
          ServerVariables vars,
          IUrlRegistry registry)
        {
            _siteSettings = siteSettings;

            if (content == null) return;

            var url = registry != null && vars != null ? registry.BuildAbsoluteUrlTemplate(vars, r => r.UrlFor(new ContentId(content.Id))) : null;
            CommentData = new CommentDataVM(
                content.Id, 
                url,
                _siteSettings.DisqusSiteIdentifier, 
                _siteSettings.DisqusDeveloperMode,
                HtmlTags.JsonUtil.ToJson(content.Title));
            MapData(content);
        }
예제 #6
0
파일: ContentVM.cs 프로젝트: flq/Rf.Sites
        private void HandleAttachments(Content content)
        {
            AttachmentCount = content.AttachmentCount;

            if (AttachmentCount > 0)
            {
                var converter = new AttachmentConverter(_siteSettings);
                Attachments = content.Attachments.Select(converter.Convert);
            }
        }
예제 #7
0
 public void ContainsWillSaythatItemDoesNotExist()
 {
     var c = new Content(13);
     var repC = new Repository<Content>(Factory);
     Assert.IsFalse(repC.Contains(c));
 }