Пример #1
0
        public NodeData(NodeType nodeType, ContentListType contentListType)
        {
            staticDataIsModified = new bool[StaticDataSlotCount];
            staticData           = new object[StaticDataSlotCount];

            PropertyTypes = NodeTypeManager.GetDynamicSignature(nodeType.Id, contentListType == null ? 0 : contentListType.Id);

            dynamicData = new Dictionary <int, object>();
        }
Пример #2
0
        public NodeData(NodeType nodeType, ContentListType contentListType)
        {
            staticDataIsModified = new bool[StaticDataSlotCount];
            staticData           = new object[StaticDataSlotCount];

            PropertyTypes   = NodeTypeManager.GetDynamicSignature(nodeType.Id, contentListType == null ? 0 : contentListType.Id);
            TextPropertyIds = PropertyTypes.Where(p => p.DataType == DataType.Text).Select(p => p.Id).ToArray();

            dynamicData = new Dictionary <int, object>();
        }
        private static void SetContentHandlerAndResetManagers(string handlerName, Action action)
        {
            // set the handler of the Folder type to an unknown value
            SetContentHandler("Folder", handlerName);

            Cache.Reset();
            NodeTypeManager.Restart();
            ContentTypeManager.Reload();

            action();
        }
        public void UnknownHandler_InstallContentType_UnknownParent()
        {
            var testSystemHandlerCTD = @"<?xml version='1.0' encoding='utf-8'?>
<ContentType name='TestSystemFolder' parentType='SystemFolder' handler='SenseNet.ContentRepository.Tests.TestSystemFolder' xmlns='http://schemas.sensenet.com/SenseNet/ContentRepository/ContentTypeDefinition'>
</ContentType>
";

            Test(() =>
            {
                // set the handler of the Folder type to an unknown value
                SetContentHandler("Folder", "UnknownParent");

                NodeTypeManager.Restart();
                ContentTypeManager.Reset();
                Cache.Reset();

                // this should throw an exception: installing a content type with an unknown parent
                ContentTypeInstaller.InstallContentType(testSystemHandlerCTD);
            });
        }
        private static void ResetAndFailToCreateContent()
        {
            Cache.Reset();
            NodeTypeManager.Restart();
            ContentTypeManager.Reload();

            var parent = Node.Load <GenericContent>("/Root");

            // try to create a content with an unknown field
            ExpectException(() =>
            {
                var content = Content.CreateNew("Folder", parent, Guid.NewGuid().ToString());
                content.Save();
            }, typeof(SnNotSupportedException));

            // try to create a content with a known handler that has an unknown parent
            ExpectException(() =>
            {
                var content = Content.CreateNew("SystemFolder", parent, Guid.NewGuid().ToString());
                content.Save();
            }, typeof(SnNotSupportedException));
        }
        public void UnknownHandler_CreateContent_FieldTable()
        {
            // This test is necessary because the OData layer calls the field name getter method.
            Test(() =>
            {
                var parent           = Node.Load <GenericContent>("/Root");
                var content          = Content.CreateNew("Folder", parent, Guid.NewGuid().ToString());
                var fieldNamesBefore = string.Join(",", content.GetFieldNamesInParentTable().OrderBy(fn => fn));

                // set the handler of the Folder type to an unknown value
                SetContentHandler("Folder", "UnknownFieldTable");

                Cache.Reset();
                NodeTypeManager.Restart();
                ContentTypeManager.Reload();

                parent              = Node.Load <GenericContent>("/Root");
                content             = Content.CreateNew("Folder", parent, Guid.NewGuid().ToString());
                var fieldNamesAfter = string.Join(",", content.GetFieldNamesInParentTable().OrderBy(fn => fn));

                Assert.AreEqual(fieldNamesBefore, fieldNamesAfter);
            });
        }
Пример #7
0
 public static void Reload()
 {
     NodeTypeManager.Reload();
 }
Пример #8
0
 /// <summary>
 /// Resets the NodeTypeManager instance.
 /// </summary>
 public static void Reset()
 {
     // The NodeTypeManager distributes its restart, no distrib action needed
     NodeTypeManager.Restart();
 }