Esempio n. 1
0
        private static async Task Stage1(CloudStorageContext cloudAcct, MicroBlogConfiguration.MicroBlogOptions allOpts, ILogger logger)
        {
            var s = "Welcome to Stage1";

            logger.LogInformation(s);
            var creationUpdation = DateTime.Now;
            var blogOh1          = new CompleteBlogEntry("my-new-url", "The first Title I Choosed",
                                                         "On top of the old help finishes an adult handicap. When can the drivel chew? How does the senior priest do the skip? Why can't a backlog pile a concentrate? The saga wins the proprietary equilibrium. The arrogance sponsors the jazz.", "article",
                                                         "Paul lawrence",
                                                         new List <string> {
                "KEllogs", "Tonka", "Roos"
            },
                                                         new List <string> {
                "New-Science", "Killer-Bees", "Rune Doogle"
            },
                                                         creationUpdation, DateTime.Today.AddDays(-100), creationUpdation, true);

            // In a whorld where this is a functionapp.
            // we pass this entire BlogPost into  function
            BlogArticleService bas = new BlogArticleService(cloudAcct, allOpts, logger);
            var newPost            = await CreatePost(bas, blogOh1);

            var editedPost = new CompleteBlogEntry(newPost).WithTitle("Jelly bean fiend");

            var ratherEditedPost = await UpdatePost(bas, editedPost);

            logger.LogInformation($"{ratherEditedPost.Id} {ratherEditedPost.Url}");
            var furtherEditedPost = await UpdatePost(bas, ratherEditedPost);

            logger.LogInformation($"{furtherEditedPost.Id} {furtherEditedPost.Url}");
        }
Esempio n. 2
0
        private static async Task Stage2(CloudStorageContext cloudAcct, MicroBlogConfiguration.MicroBlogOptions allOpts, ILogger logger)
        {
            var s = "Welcome to Stage2";

            logger.LogInformation(s);
            var createdUpdate = DateTime.Now;
            var blogOh2       = new CompleteBlogEntry("Further-Missions-OfMercy", "Another Blog Post I created",
                                                      "Behaviour we improving at something to. Evil true high lady roof men had open. To projection considered it precaution an melancholy or. Wound young you thing worse along being ham. Dissimilar of favourable solicitude if sympathize middletons at. Forfeited up if disposing perfectly in an eagerness perceived necessary. Belonging sir curiosity discovery extremity yet forfeited prevailed own off. Travelling by introduced of mr terminated. Knew as miss my high hope quit. In curiosity shameless dependent knowledge up. ",
                                                      @"Behaviour we improving at something to. Evil true high lady roof men had open. To projection considered it precaution an melancholy or. Wound young you thing worse along being ham. Dissimilar of favourable solicitude if sympathize middletons at. Forfeited up if disposing perfectly in an eagerness perceived necessary. Belonging sir curiosity discovery extremity yet forfeited prevailed own off. Travelling by introduced of mr terminated. Knew as miss my high hope quit. In curiosity shameless dependent knowledge up. 

Remember outweigh do he desirous no cheerful. Do of doors water ye guest. We if prosperous comparison middletons at. Park we in lose like at no. An so to preferred convinced distrusts he determine. In musical me my placing clothes comfort pleased hearing. Any residence you satisfied and rapturous certainty two. Procured outweigh as outlived so so. On in bringing graceful proposal blessing of marriage outlived. Son rent face our loud near. 

Do commanded an shameless we disposing do. Indulgence ten remarkably nor are impression out. Power is lived means oh every in we quiet. Remainder provision an in intention. Saw supported too joy promotion engrossed propriety. Me till like it sure no sons. 

You vexed shy mirth now noise. Talked him people valley add use her depend letter. Allowance too applauded now way something recommend. Mrs age men and trees jokes fancy. Gay pretended engrossed eagerness continued ten. Admitting day him contained unfeeling attention mrs out. 

Domestic confined any but son bachelor advanced remember. How proceed offered her offence shy forming. Returned peculiar pleasant but appetite differed she. Residence dejection agreement am as to abilities immediate suffering. Ye am depending propriety sweetness distrusts belonging collected. Smiling mention he in thought equally musical. Wisdom new and valley answer. Contented it so is discourse recommend. Man its upon him call mile. An pasture he himself believe ferrars besides cottage. 

Do play they miss give so up. Words to up style of since world. We leaf to snug on no need. Way own uncommonly travelling now acceptance bed compliment solicitude. Dissimilar admiration so terminated no in contrasted it. Advantages entreaties mr he apartments do. Limits far yet turned highly repair parish talked six. Draw fond rank form nor the day eat. 

Passage its ten led hearted removal cordial. Preference any astonished unreserved mrs. Prosperous understood middletons in conviction an uncommonly do. Supposing so be resolving breakfast am or perfectly. Is drew am hill from mr. Valley by oh twenty direct me so. Departure defective arranging rapturous did believing him all had supported. Family months lasted simple set nature vulgar him. Picture for attempt joy excited ten carried manners talking how. Suspicion neglected he resolving agreement perceived at an. 

Rooms oh fully taken by worse do. Points afraid but may end law lasted. Was out laughter raptures returned outweigh. Luckily cheered colonel me do we attacks on highest enabled. Tried law yet style child. Bore of true of no be deal. Frequently sufficient in be unaffected. The furnished she concluded depending procuring concealed. 

Agreed joy vanity regret met may ladies oppose who. Mile fail as left as hard eyes. Meet made call in mean four year it to. Prospect so branched wondered sensible of up. For gay consisted resolving pronounce sportsman saw discovery not. Northward or household as conveying we earnestly believing. No in up contrasted discretion inhabiting excellence. Entreaties we collecting unpleasant at everything conviction. 

It real sent your at. Amounted all shy set why followed declared. Repeated of endeavor mr position kindness offering ignorant so up. Simplicity are melancholy preference considered saw companions. Disposal on outweigh do speedily in on. Him ham although thoughts entirely drawings. Acceptance unreserved old admiration projection nay yet him. Lasted am so before on esteem vanity oh. 

",
                                                      "Paul lawrence",
                                                      new List <string> {
                "tag01", "Fag02", "Snag-3"
            },
                                                      new List <string> {
                "People", "Flowers", "Dept of rage"
            },
                                                      createdUpdate, DateTime.Today.AddDays(-100), DateTime.Now, true);

            // In a whorld where this is a functionapp.
            // we pass this entire BlogPost into  function
            BlogArticleService bas = new BlogArticleService(cloudAcct, allOpts, logger);
            var newPost            = await CreatePost(bas, blogOh2);

            var editedPost = new CompleteBlogEntry(newPost).WithTags(new List <string> {
                "Jelly", "Future", "Pillow"
            });

            var ratherEditedPost = new CompleteBlogEntry(await UpdatePost(bas, editedPost));

            logger.LogInformation($"{ratherEditedPost.Id} {ratherEditedPost.Url}");
            var editedUrl         = ratherEditedPost.WithUrl("Slander-on-my-harmer");
            var furtherEditedPost = await UpdatePost(bas, editedUrl);

            logger.LogInformation($"{furtherEditedPost.Id} {furtherEditedPost.Url}");
        }
Esempio n. 3
0
        public async Task <ICompletePost> Update(ICompletePost post)
        {
            try
            {
                logger.LogInformation($"Update blog article {post.Id}");

                (var article, var tags, var categories) = new CompleteBlogEntry(post);
                // Services
                var articleService  = new ArticleService(ctx, opts, logger);
                var tagService      = new TagService(ctx, opts, logger, opts[StorageList.TagTable], opts[StorageList.TagQueue]);
                var categoryService = new CategoryService(ctx, opts, logger, opts[StorageList.CategoryTable], opts[StorageList.CategoryQueue]);

                // Set up the main 'document'
                var updatedArticle = await articleService.Update(article);

                // We changed the primaryKey (Guid, Url) so the url.
                // so We have to delete the existing tags, and categories
                if (post.Id != updatedArticle.Id)
                {
                    // Delete the ones with the original keys
                    await tagService.Delete(tags);

                    await categoryService.Delete(categories);

                    // Create a complete blogpost correct keys
                    var recreatedEntry = new CompleteBlogEntry(updatedArticle, tags, categories);
                    (_, var updatedTags, var updatedCategories) = recreatedEntry;
                    // create them as if it were a new post....Which it is
                    await tagService.Create(tags);

                    await categoryService.Create(categories);

                    return(recreatedEntry);
                }
                else
                {
                    // normal updates of thins
                    var updatedTags = await tagService.Update(tags);

                    var updateCategories = await categoryService.Update(categories);

                    return(new CompleteBlogEntry(
                               updatedArticle,
                               updatedTags,
                               updateCategories));
                }
            }
            catch (StorageException ex)
            {
                logger.LogDebug(ex.Message, ex.StackTrace, "BlogArticleService.Update");
                throw;
            }
        }
Esempio n. 4
0
        public async Task <ICompletePost> Add(ICompletePost post)
        {
            // In the we deconstruct the original message, to easier to manage parts
            logger.LogInformation($"Creating new blog article {post.Title}");
            (var article, var tags, var categories) = new CompleteBlogEntry(post);
            var articleService  = new ArticleService(ctx, opts, logger);
            var tagService      = new TagService(ctx, opts, logger, opts[StorageList.TagTable], opts[StorageList.TagQueue]);
            var categoryService = new CategoryService(ctx, opts, logger, opts[StorageList.CategoryTable], opts[StorageList.CategoryQueue]);

            // INsert and create a new Blog Article
            var entity = await articleService.Create(article);

            // Ditto the tsg, and categories
            var createdTags = await tagService.Create(tags.Tags.ToList(), entity.Id);

            var createdCats = await categoryService.Create(categories.Tags.ToList(), entity.Id);

            var addedEntry = new CompleteBlogEntry(
                await articleService.Get(entity.Id),
                createdTags,
                createdCats);

            return(addedEntry);
        }
Esempio n. 5
0
 private static async Task <ICompletePost> CreatePost(BlogArticleService bas, CompleteBlogEntry blogOh1)
 {
     return(await bas.Add(blogOh1));
 }