public async Task SaveBlogMeta(BlogSetting blogSetting, BlogMeta blogMeta) { if (blogSetting == null) { throw new ArgumentNullException(nameof(blogSetting)); } if (blogMeta == null) { throw new ArgumentNullException(nameof(blogMeta)); } using (var session = this.DocumentStore.OpenAsyncSession()) { string blogMetaId = RavenDbIdConventions.GetBlogMetaId(blogSetting.BlogKey); var existingMeta = await session.LoadAsync<BlogMeta>(blogMetaId); if (existingMeta == null) { existingMeta = new BlogMeta { BlogKey = blogSetting.BlogKey }; await session.StoreAsync(existingMeta); } existingMeta.Description = blogMeta.Description; existingMeta.Name = blogMeta.Name; existingMeta.PublishedAt = blogMeta.PublishedAt; existingMeta.SourceId = blogMeta.SourceId; existingMeta.UpdatedAt = blogMeta.UpdatedAt; existingMeta.Url = blogMeta.Url; await session.SaveChangesAsync(); } }
public async Task SaveBlogMeta(BlogSetting blogSetting, BlogMeta blogMeta) { if (blogSetting == null) { throw new ArgumentNullException(nameof(blogSetting)); } if (blogMeta == null) { throw new ArgumentNullException(nameof(blogMeta)); } var existingMeta = await this.DbContext.BlogMetas.SingleOrDefaultLocalOrSourceAsync( x => x.BlogKey.Equals(blogSetting.BlogKey, StringComparison.OrdinalIgnoreCase)); if (existingMeta == null) { existingMeta = new BlogMeta { BlogKey = blogSetting.BlogKey }; await this.DbContext.BlogMetas.AddAsync(existingMeta); } existingMeta.Description = blogMeta.Description; existingMeta.Name = blogMeta.Name; existingMeta.PublishedAt = blogMeta.PublishedAt; existingMeta.SourceId = blogMeta.SourceId; existingMeta.UpdatedAt = blogMeta.UpdatedAt; existingMeta.Url = blogMeta.Url; await this.DbContext.SaveChangesAsync(); }
public static BlogMeta Create(string blogKey = null) { var meta = new BlogMeta { BlogKey = blogKey ?? BlogKey, Description = BlogMetaDescription, Name = BlogMetaName, PublishedAt = BlogMetaPublishedAt, SourceId = BlogMetaSourceId, UpdatedAt = BlogMetaUpdatedAt, Url = "http://testurl.com/testar/test.html" }; return meta; }
public static BlogMeta ConvertMeta(BloggerBlogData blog) { if (blog == null) { throw new ArgumentNullException(nameof(blog)); } var blogMeta = new BlogMeta { Description = blog.Description, Name = blog.Name, PublishedAt = blog.Published, SourceId = blog.Id, UpdatedAt = blog.Updated, Url = blog.Url }; return blogMeta; }
public Task SaveBlogMeta(BlogSetting blogSetting, BlogMeta blogMeta) { this.OnSaveBlogMetaRun?.Invoke(this, blogSetting.BlogKey); return Task.CompletedTask; }
internal void OnDataUpdated(BlogMeta blogMeta, BlogSyncPostsChangeSet changeSet) { this.BlogMeta = blogMeta; this.BlogPostsChanges = changeSet; }