Наследование: DocumentTypeBase
Пример #1
0
        private void AddSeedContent()
        {
            //try
            {
                var homePage = new HomePage();
                homePage.Content = new HomePage.ContentTab();
                homePage.Content.WelcomeParagraph = new DataTypes.BuiltIn.RichtextEditor() { Value = "Welcome to the Felinesoft Code-First quiz. This quiz tests your knowledge of Felinesoft Code-First for Umbraco." };
                homePage.NodeDetails.Name = "Code-First Quiz";
                homePage.Persist(publish: true);

                CreateFactoids();

                CreateSet1(homePage);
                CreateSet2(homePage);
                CreateSet3(homePage);
            }
            //catch
            //{
            //	foreach(var c in ApplicationContext.Current.Services.ContentService.GetRootContent())
            //	{
            //		ApplicationContext.Current.Services.ContentService.Delete(c);
            //	}
            //	throw;
            //}
        }
Пример #2
0
        private void CreateSet2(HomePage homePage)
        {
            var questionSet2 = new QuestionSet();
            questionSet2.Content = new QuestionSet.ContentTab();
            questionSet2.Content.WelcomeParagraph = new DataTypes.BuiltIn.RichtextEditor() { Value = "This question set tests your knowledge of declaring and using code-first data types." };
            questionSet2.NodeDetails.Name = "Data Type Quiz";
            questionSet2.Persist(parentId: homePage.NodeDetails.UmbracoId, publish: true);

            var question1 = CreateQuestion
            (
                "Data type attribute",
                "What is the correct attribute to use to signal that a class represents a data type?",
                "[Type]",
                "[CodeFirstData]",
                "[UmbracoDataType]",
                "[DataType]",
                4
            );
            question1.Extras = new Question.ExtrasTab();
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Persist(parentId: questionSet2.NodeDetails.UmbracoId, publish: true);

            var question2 = CreateQuestion
            (
                "Data type interfaces",
                "Which of the following is the correct interface to implement to create a data type which is stored as a string and can accomodate a large amount of data?",
                "IUmbracoNtextDataType",
                "IUmbracoStringDataType",
                "IUmbracoDataTypeNtext",
                "IUmbracoDataTypeString",
                1
            );
            question2.Extras = new Question.ExtrasTab();
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Persist(parentId: questionSet2.NodeDetails.UmbracoId, publish: true);

            var question3 = CreateQuestion
            (
                "Data type implementation",
                "When is it OK to leave the interface methods unimplemented on a data type?",
                "When strongly-typed views are not being used, or that data type is not being used within them",
                "When the data value is always null/default",
                "For any data value which is stored as a string in the database",
                "Never",
                1
            );
            question3.Extras = new Question.ExtrasTab();
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Persist(parentId: questionSet2.NodeDetails.UmbracoId, publish: true);
        }
Пример #3
0
        private void CreateSet3(HomePage homePage)
        {
            var questionSet3 = new QuestionSet();
            questionSet3.Content = new QuestionSet.ContentTab();
            questionSet3.Content.WelcomeParagraph = new DataTypes.BuiltIn.RichtextEditor() { Value = "This question set tests your knowledge of declaring and using code-first dictionaries." };
            questionSet3.NodeDetails.Name = "Dictionary Quiz";
            questionSet3.Persist(parentId: homePage.NodeDetails.UmbracoId, publish: true);

            var question1 = CreateQuestion
            (
                "Dictionary attribute",
                "What is the correct attribute to use to signal that a class represents a dictionary?",
                "[Dictionary]",
                "[CodeFirstDictionary]",
                "[Dict]",
                "[UmbracoDictionary]",
                1
            );
            question1.Extras = new Question.ExtrasTab();
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Persist(parentId: questionSet3.NodeDetails.UmbracoId, publish: true);

            var question2 = CreateQuestion
            (
                "Dictionary items",
                "What is the correct attribute to use to signal that a property represents a dictionary item?",
                "[DictItem]",
                "[DictionaryItem]",
                "[Item]",
                "[DictionaryEntry]",
                3
            );
            question2.Extras = new Question.ExtrasTab();
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Persist(parentId: questionSet3.NodeDetails.UmbracoId, publish: true);

            var question3 = CreateQuestion
            (
                "Dictionary base class",
                "What is the correct base class to inherit from when declaring a dictionary class?",
                "CodeFirstDictionaryBase",
                "DictBase",
                "UmbracoDictionary",
                "DictionaryBase",
                4
            );
            question3.Extras = new Question.ExtrasTab();
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Persist(parentId: questionSet3.NodeDetails.UmbracoId, publish: true);
        }
Пример #4
0
        private void CreateSet1(HomePage homePage)
        {
            var questionSet1 = new QuestionSet();
            questionSet1.Content = new QuestionSet.ContentTab();
            questionSet1.Content.WelcomeParagraph = new DataTypes.BuiltIn.RichtextEditor() { Value = "This question set tests your knowledge of declaring and using code-first document types." };
            questionSet1.NodeDetails.Name = "Document Type Quiz";
            questionSet1.Persist(parentId: homePage.NodeDetails.UmbracoId, publish: true);

            var question1 = CreateQuestion
            (
                "Document type attribute",
                "What is the correct attribute to use to signal that a class represents a document type?",
                "[DocumentType]",
                "[ContentType]",
                "[DocumentClass]",
                "[CodeFirstDocument]",
                1
            );
            question1.Extras = new Question.ExtrasTab();
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question1.Persist(parentId: questionSet1.NodeDetails.UmbracoId, publish: true);

            var question2 = CreateQuestion
            (
                "Document type base",
                "What is the correct base class to inherit from when declaring a document type class?",
                "CodeFirstDocumentType",
                "ContentTypeBase",
                "BaseDocumentType",
                "DocumentTypeBase",
                4
            );
            question2.Extras = new Question.ExtrasTab();
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question2.Persist(parentId: questionSet1.NodeDetails.UmbracoId, publish: true);

            var question3 = CreateQuestion
            (
                "Property type",
                "What is the correct attribute to use to signal that a property of a class represents an Umbraco property type?",
                "[Property]",
                "[ContentProperty]",
                "[DocumentProperty]",
                "[CodeFirstProperty]",
                2
            );
            question3.Extras = new Question.ExtrasTab();
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Extras.Factoids.Add(_factoids.ElementAt(_randy.Next(0, _factoids.Count)));
            question3.Persist(parentId: questionSet1.NodeDetails.UmbracoId, publish: true);
        }