private string CreateEditContentTypeUrl(ContentTypeModel contentTypeModel)
        {
            var urlBuilder = new UrlBuilder(UriSupport.AbsoluteUrlFromUIBySettings("Admin/EditContentType.aspx"));

            urlBuilder.QueryCollection["typeId"] = contentTypeModel.Id.ToString();
            return(urlBuilder.ToString());
        }
示例#2
0
        public ActionResult DeleteAllowedContentType(string id)
        {
            //return RedirectToAction("Index");
            ContentTypeModel model = new ContentTypeModel();

            var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

            using (var clientContext = spContext.CreateUserClientContextForSPHost())
            {
                if (clientContext != null)
                {
                    Web web = clientContext.Web;
                    clientContext.Load(web, w => w.ContentTypes, w => w.Fields);
                    clientContext.ExecuteQuery();

                    var query = from ct in web.ContentTypes
                                where ct.Id.StringValue == id
                                select ct;
                    ContentType ctFound = query.First();
                    model.Name = ctFound.Name;
                    model.Id   = ctFound.Id;
                }
            }
            return(View("DeleteAllowedContentType", model));
        }
示例#3
0
        internal ClassCodeGenerator GetClassCodeGenerator(ContentTypeModel contentType, IEnumerable <ContentTypeSnippetModel> managementSnippets)
        {
            var classDefinition = new ClassDefinition(contentType.Codename);

            foreach (var element in contentType.Elements)
            {
                try
                {
                    if (element.Type != ElementMetadataType.ContentTypeSnippet)
                    {
                        AddProperty(Property.FromContentTypeElement(element), ref classDefinition);
                    }
                    else
                    {
                        var snippetElements = ManagementElementHelper.GetManagementContentTypeSnippetElements(element, managementSnippets);
                        foreach (var snippetElement in snippetElements)
                        {
                            AddProperty(Property.FromContentTypeElement(snippetElement), ref classDefinition);
                        }
                    }
                }
                catch (Exception e)
                {
                    WriteConsoleErrorMessage(e, element.Codename, element.Type.ToString(), classDefinition.ClassName);
                }
            }

            var classFilename = GetFileClassName(classDefinition.ClassName);

            return(ClassCodeGeneratorFactory.CreateClassCodeGenerator(Options, classDefinition, classFilename));
        }
示例#4
0
        public void GetClassCodeGenerator_Returns()
        {
            var mockOptions = new Mock <IOptions <CodeGeneratorOptions> >();

            mockOptions.SetupGet(option => option.Value).Returns(new CodeGeneratorOptions
            {
                ManagementApi = true
            });

            var outputProvider   = new Mock <IOutputProvider>();
            var managementClient = new Mock <IManagementClient>();

            var contentTypeCodename = "Contenttype";
            var elementCodename     = "element_codename";
            var contentType         = new ContentTypeModel
            {
                Codename = contentTypeCodename,
                Elements = new List <ElementMetadataBase>
                {
                    TestHelper.GenerateElementMetadataBase(Guid.NewGuid(), elementCodename)
                }
            };

            var codeGenerator = new ManagementCodeGenerator(mockOptions.Object, outputProvider.Object, managementClient.Object);

            var result = codeGenerator.GetClassCodeGenerator(contentType, new List <ContentTypeSnippetModel>());

            Assert.Equal($"{contentTypeCodename}.Generated", result.ClassFilename);
        }
        private ContentTypeAnalyzerModel.ContentTypeModel CreateContentTypeModel(ContentTypeModel contentTypeModel)
        {
            var hasConflict = contentTypeModel.State == SynchronizationStatus.Conflict;

            return(new ContentTypeAnalyzerModel.ContentTypeModel
            {
                Type = "Content Type Model",
                DisplayName = contentTypeModel.DisplayName,
                Name = contentTypeModel.Name,
                State = contentTypeModel.State.ToString(),
                Description = contentTypeModel.Description,
                HasConflict = contentTypeModel.State == SynchronizationStatus.Conflict,
                Conflicts = FindConflicts(contentTypeModel, hasConflict)
            });
        }
        public override bool ShouldIgnoreProperty(ContentTypeModel contentTypeModel, PropertyInfo property)
        {
            bool isEpiProperty = IsEPiProperty(contentTypeModel, property);

            var result = isEpiProperty || base.ShouldIgnoreProperty(contentTypeModel, property);

            if (isEpiProperty)
            {
                Debug.WriteLine("[EPiProperties] EPiProperty detected: {0}.{1}", property.DeclaringType.FullName, property.Name);
            }

            if (!result)
            {
                Debug.WriteLine("[EPiProperties] Property to sync: {0}.{1}", property.DeclaringType.FullName, property.Name);
            }

            return result;
        }
        private static bool AclInSynch(ContentTypeModel model, ContentType contentType)
        {
            if (contentType.ACL == null && model.ACL == null)
            {
                return(true);
            }

            if (contentType.ACL != null && model.ACL != null)
            {
                return(contentType.ACL.EntriesEquals(
                           model.ACL ?? new AccessControlList
                {
                    new AccessControlEntry(EveryoneRole.RoleName, AccessLevel.Create)
                }));
            }

            return(false);
        }
示例#8
0
        public override bool ShouldIgnoreProperty(ContentTypeModel contentTypeModel, PropertyInfo property)
        {
            bool isEpiProperty = IsEPiProperty(contentTypeModel, property);

            var result = isEpiProperty || base.ShouldIgnoreProperty(contentTypeModel, property);

            if (isEpiProperty)
            {
                Debug.WriteLine("[EPiProperties] EPiProperty detected: {0}.{1}", property.DeclaringType.FullName, property.Name);
            }

            if (!result)
            {
                Debug.WriteLine("[EPiProperties] Property to sync: {0}.{1}", property.DeclaringType.FullName, property.Name);
            }

            return(result);
        }
        /// <summary>
        /// Gets a ContentTypeModel by its Id.
        /// Used for showing the Properties Frame.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ContentTypeModel GetContentTypeModelById(int id)
        {
            var properties = _bridge.GetContentTypeProperties(id);
            var model      = new ContentTypeModel
            {
                Id        = id,
                Type      = "ContentType",
                Alias     = properties["Alias"],
                Created   = properties["CreateDate"],
                Level     = int.Parse(properties["Level"]),
                Name      = properties["Name"],
                ParentId  = int.Parse(properties["ParentId"]),
                Path      = properties["Path"],
                SortOrder = int.Parse(properties["SortOrder"]),
                Template  = properties["TemplateAlias"],
                UniqueId  = new Guid(properties["UniqueId"])
            };

            return(model);
        }
 public virtual bool IsEPiProperty(ContentTypeModel contentTypeModel, PropertyInfo property)
 {
     return EpiPropertiesRegistry.IsEPiProperty(property);
 }
        public void SetUp()
        {
            //Initializaing Mappings
            DtoMappings.Initialize();


            //Initializing Data
            TestShoutBoxMessage = new ShoutBoxMessageModel {
                Author = "test", Message = "test", ShoutBoxId = 1, TimePosted = new DateTime(2010, 10, 10, 10, 10, 10)
            };
            TestShoutBoxMessage1 = new ShoutBoxMessageModel {
                Author = "test", Message = "testLatest", ShoutBoxId = 1, TimePosted = new DateTime(2011, 10, 10, 10, 10, 10)
            };
            TestQuestionAnswer = new TestQuestionAnswer {
                Correct = true, NumberSelected = 0, Text = "test"
            };
            TestQuestion = new TestQuestionModel
            {
                QuestionText = "test question", QuestionLabel = "test", Answers = new List <TestQuestionAnswer>
                {
                    TestQuestionAnswer
                }
            };
            TestTestType = new TestTypeModel {
                TypeName = "test"
            };
            TestPofile = new ProfileModel {
                LoginName = "test", Email = "*****@*****.**", IsActive = true
            };
            TestTest = new TestModel
            {
                Author = TestPofile, CreationDate = new DateTime(2010, 1, 1), Name = "test", TestType = TestTestType
            };
            LatestTest = new TestModel
            {
                Author = TestPofile, CreationDate = new DateTime(2011, 1, 1), Name = "test", TestType = TestTestType
            };
            TestCourseType = new CourseTypeModel {
                TypeName = "Fizyka"
            };
            TestCourseType1 = new CourseTypeModel {
                TypeName = "Matematyka"
            };
            TestGroupType = new GroupTypeModel {
                TypeName = "test"
            };
            TestGroupType1 = new GroupTypeModel {
                TypeName = "test1"
            };
            TestGroup = new GroupModel {
                GroupType = TestGroupType, GroupName = "test"
            };
            TestForum = new ForumModel {
                Author = "test", Name = "test"
            };
            TestShoutBox = new ShoutboxModel();
            TestShoutBox.Messages.Add(TestShoutBoxMessage);
            TestShoutBox.Messages.Add(TestShoutBoxMessage1);
            TestSurvey = new SurveyModel
            {
                SurveyText = "Smiga chodzi fruwa ?", DateCreated = new DateTime(2010, 1, 1)
            };
            TestLatestSurvey = new SurveyModel
            {
                SurveyText = "Smiga chodzi fruwa ?", DateCreated = new DateTime(2011, 1, 1)
            };


            TestCourse2 = new CourseModel
            {
                CourseType   = TestCourseType1,
                ShoutBox     = TestShoutBox,
                Forum        = TestForum,
                Group        = TestGroup,
                CreationDate = DateTime.Now,
                Description  = "test1",
                Logo         = "/test1.jpg",
                Name         = "test1",
                Password     = "******"
            };

            TestCourse3 = new CourseModel
            {
                CourseType   = TestCourseType1,
                ShoutBox     = TestShoutBox,
                Forum        = TestForum,
                Group        = TestGroup,
                CreationDate = DateTime.Now,
                Description  = "test1",
                Logo         = "/test1.jpg",
                Name         = "test1",
                Password     = null
            };
            TestContentType = new ContentTypeModel {
                TypeName = "test"
            };
            TestContent = new ContentModel
            {
                ContentUrl     = "test",
                CreationDate   = DateTime.Now,
                DownloadNumber = 0,
                Name           = "test",
                Text           = "test",
                Type           = TestContentType
            };
            TestJournalMark = new JournalMarkModel {
                Name = "Zaliczenie", Value = "5"
            };
            TestJournal = new JournalModel
            {
                Course = TestCourse3, Marks = new List <JournalMarkModel>
                {
                    TestJournalMark
                }, Name = "test journal"
            };

            FileModel = new FileModel {
                FileName = "test", Address = "test"
            };
            SectionModel = new SectionModel {
                IconName = "test", Text = "test", Title = "tset"
            };

            LearningMaterialModel = new LearningMaterialModel
            {
                Level         = 1,
                CreationDate  = DateTime.Now,
                Description   = "test",
                Goals         = "test",
                Summary       = "test",
                UpdateDate    = DateTime.Now,
                VersionNumber = "111",
                Tests         = new List <TestModel> {
                    TestTest
                },
                Files = new List <FileModel> {
                    FileModel
                },
                Sections = new List <SectionModel> {
                    SectionModel
                }
            };
            TestCourse1 = new CourseModel
            {
                CourseType        = TestCourseType,
                ShoutBox          = TestShoutBox,
                Forum             = TestForum,
                Group             = TestGroup,
                CreationDate      = DateTime.Now,
                Description       = "test",
                Logo              = "/test.jpg",
                Name              = "test",
                Password          = "******",
                LearningMaterials = new List <LearningMaterialModel> {
                    LearningMaterialModel
                }
            };

            using (var session = DataAccess.OpenSession())
            {
                session.Save(TestPofile);
                session.Save(TestShoutBoxMessage);
                session.Save(TestShoutBoxMessage1);
                session.Save(TestCourseType);
                session.Save(TestGroupType);
                session.Save(TestGroupType1);
                session.Save(TestGroup);
                session.Save(TestForum);
                session.Save(TestShoutBox);
                session.Save(TestCourseType1);
                session.Save(TestSurvey);
                session.Save(TestLatestSurvey);
                session.Save(TestTestType);
                session.Save(TestTest);
                session.Save(LatestTest);
                session.Save(TestCourse1);
                session.Save(TestCourse2);
                session.Save(TestQuestionAnswer);
                session.Save(TestQuestion);
                session.Save(TestCourse3);
                session.Save(TestJournalMark);
                session.Save(TestJournal);
                session.Save(TestContentType);
                session.Save(TestContent);
                session.Save(FileModel);
                session.Save(SectionModel);
                session.Save(LearningMaterialModel);
                session.Flush();
            }
        }
        private IEnumerable <ContentTypeAnalyzerModel.ConflictModel> FindConflicts(ContentTypeModel model, bool hasConflict)
        {
            if (!hasConflict)
            {
                yield break;
            }

            var contentType = model.ExistingContentType;

            if (!(model.ModelType == null ||
                  model.ModelType.AssemblyQualifiedName == contentType.ModelTypeString))
            {
                yield return(new ContentTypeAnalyzerModel.ConflictModel
                {
                    Name = "Model type",
                    ContentTypeModelValue = model.ModelType.ToString(),
                    ContentTypeValue = contentType.ModelTypeString
                });
            }

            if (!string.Equals(model.Name, contentType.Name))
            {
                yield return(new ContentTypeAnalyzerModel.ConflictModel
                {
                    Name = "Name",
                    ContentTypeModelValue = model.Name,
                    ContentTypeValue = contentType.Name
                });
            }

            if (!(string.IsNullOrEmpty(model.Description) ||
                  string.Equals(model.Description, contentType.Description)))
            {
                yield return(new ContentTypeAnalyzerModel.ConflictModel
                {
                    Name = "Description",
                    ContentTypeModelValue = model.Description,
                    ContentTypeValue = contentType.Description
                });
            }

            if (!(string.IsNullOrEmpty(model.DisplayName) ||
                  string.Equals(model.DisplayName, contentType.DisplayName)))
            {
                yield return(new ContentTypeAnalyzerModel.ConflictModel
                {
                    Name = "Display name",
                    ContentTypeModelValue = model.DisplayName,
                    ContentTypeValue = contentType.DisplayName
                });
            }

            if (!(!model.Order.HasValue ||
                  model.Order.Value == contentType.SortOrder))
            {
                yield return(new ContentTypeAnalyzerModel.ConflictModel
                {
                    Name = "Sort order",
                    ContentTypeModelValue = model.Order?.ToString(),
                    ContentTypeValue = contentType.SortOrder.ToString()
                });
            }

            if (!(!model.Guid.HasValue ||
                  !(model.Guid.Value != contentType.GUID)))
            {
                yield return(new ContentTypeAnalyzerModel.ConflictModel
                {
                    Name = "GUID",
                    ContentTypeModelValue = model.Guid?.ToString(),
                    ContentTypeValue = contentType.GUID.ToString()
                });
            }

            if (!(!model.AvailableInEditMode.HasValue ||
                  model.AvailableInEditMode.Value == contentType.IsAvailable))
            {
                yield return(new ContentTypeAnalyzerModel.ConflictModel
                {
                    Name = "Availability",
                    ContentTypeModelValue = model.AvailableInEditMode?.ToString(),
                    ContentTypeValue = contentType.IsAvailable.ToString()
                });
            }

            if (!AclInSynch(model, contentType))
            {
                yield return(new ContentTypeAnalyzerModel.ConflictModel
                {
                    Name = "ACL",
                    ContentTypeModelValue = AclToString(model.ACL),
                    ContentTypeValue = AclToString(contentType.ACL)
                });
            }
        }
        private ContentTypeAnalyzerModel.ContentTypeModel CreateContentTypeModel(PropertyDefinitionModel propertyDefinitionModel, ContentTypeModel contentTypeModel)
        {
            var hasConflicts = propertyDefinitionModel.State == SynchronizationStatus.Conflict;

            return(new ContentTypeAnalyzerModel.ContentTypeModel
            {
                Type = "Property Type Model",
                DisplayName = propertyDefinitionModel.DisplayName,
                Name = $"{contentTypeModel.Name}-{propertyDefinitionModel.Name}",
                State = propertyDefinitionModel.State.ToString(),
                Description = propertyDefinitionModel.Description,
                HasConflict = hasConflicts,
                Conflicts = FindConflicts(propertyDefinitionModel, hasConflicts)
            });
        }
示例#14
0
        internal async Task <bool> EnsureProject()
        {
            //get GUIDs for content types from config file, if not available, try to get them from project, if not found, create them
            if (this.conversationTypeGuid != Guid.Empty && this.userTypeGuid != Guid.Empty)
            {
                return(true);
            }

            HttpResponseMessage result;

            using (HttpClient httpClient = new HttpClient())
            {
                string[] conversationElementValues =
                {
                    "ConversationId,conversationid,text",
                    "IntercomLink,intercomlink,rich_text",
                    "Messages,messages,rich_text",
                    "CreatedAt,createdat,date_time",
                    "LastUpdated,lastupdated,date_time",
                    "Author,author,modular_content",
                    "Assignee,assignee,modular_content",
                    "Participants,participants,modular_content",
                    "RatingValue,ratingvalue,text",
                    "RatingNote,ratingnote,text",
                    "Tags,tags,text",
                    "MessageCount,messagecount,number",
                    "SearchBody,searchbody,text"
                };

                ContentTypeElementModel func(string x)
                {
                    var splitString = x.Split(',');

                    return(new ContentTypeElementModel(splitString[0], splitString[1], splitString[2]));
                }

                List <ContentTypeElementModel> conversationTypeElements = new List <ContentTypeElementModel>(
                    conversationElementValues
                    .Select(x => func(x)));


                ContentTypeModel conversationModel = new ContentTypeModel()
                {
                    ExternaId = "conversation",
                    Name      = "Conversation",
                    Codename  = "conversation",
                    Elements  = conversationTypeElements
                };

                var payload = JsonConvert.SerializeObject(conversationModel);

                httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + options.ApiKey);
                result = await httpClient.PostAsync("https://manage.kenticocloud.com/v2/projects/" + options.ProjectId + "/types", new StringContent(payload, Encoding.UTF8, "application/json"));
            }

            var reply = await result.Content.ReadAsStringAsync();

            if (reply == null)
            {
                return(false);
            }

            dynamic output = JsonConvert.DeserializeObject(reply);
            Guid    conversationTypeGuid = Guid.Parse(output.GetValue("id").ToString());

            using (HttpClient httpClient = new HttpClient())
            {
                string[] userElementValues =
                {
                    "IntercomLink,intercomlink,rich_text",
                    "Name,name,text",
                    "Email,email,text",
                    "Type,type,text",
                    "Id,id,text",
                };

                ContentTypeElementModel func(string x)
                {
                    var splitString = x.Split(',');

                    return(new ContentTypeElementModel(splitString[0], splitString[1], splitString[2]));
                }

                List <ContentTypeElementModel> userTypeElements = new List <ContentTypeElementModel>(
                    userElementValues
                    .Select(x => func(x)));


                ContentTypeModel conversationModel = new ContentTypeModel()
                {
                    ExternaId = "user",
                    Name      = "User",
                    Codename  = "user",
                    Elements  = userTypeElements
                };

                var payload = JsonConvert.SerializeObject(conversationModel);

                httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + options.ApiKey);
                result = await httpClient.PostAsync("https://manage.kenticocloud.com/v2/projects/" + options.ProjectId + "/types", new StringContent(payload, Encoding.UTF8, "application/json"));
            }

            reply = await result.Content.ReadAsStringAsync();

            if (reply == null)
            {
                return(false);
            }

            output = JsonConvert.DeserializeObject(reply);
            Guid userTypeGuid = Guid.Parse(output.GetValue("id").ToString());

            Guid[] array = new Guid[] { conversationTypeGuid, userTypeGuid };
            return(true);
        }
示例#15
0
 public virtual bool IsEPiProperty(ContentTypeModel contentTypeModel, PropertyInfo property)
 {
     return(EpiPropertiesRegistry.IsEPiProperty(property));
 }
        /// <summary>
        /// Almost exact implementation of the AssignValuesToPropertyDefinition in the ContentDataAttributeScanningAssigner
        /// the only thing that differs is the added call to CustomAllowedTypes.GetMergedAllowedTypesAttribute.
        /// That call allows us to add more types to the Allowed/RestricedTypes without using the AllowedTypes attribute.
        /// </summary>
        /// <param name="propertyDefinitionModel"></param>
        /// <param name="property"></param>
        /// <param name="parentModel"></param>
        public override void AssignValuesToPropertyDefinition(PropertyDefinitionModel propertyDefinitionModel, PropertyInfo property, ContentTypeModel parentModel)
        {
            if (property.IsAutoGenerated() && !property.IsAutoVirtualPublic())
            {
                var exceptionMessage = string.Format(CultureInfo.InvariantCulture,
                                                     "The property '{0}' on the content type '{1}' is autogenerated but not virtual declared.",
                                                     property.Name, property.DeclaringType.Name);
                throw new InvalidOperationException(exceptionMessage);
            }

            //This is our added logic to merge a predefined AllowedTypes attribute with our own AllowedTypes specified in code.
            #region ModularAllowedTypes
            var customAttributes = Attribute.GetCustomAttributes(property, true).ToList();
            var injectedAllowedTypesAttribute = InjectedAllowedTypes.GetInjectedAllowedTypesAttribute(parentModel.ModelType,
                                                                                                      property.Name);
            var specifiedAllowedTypesAttribute = property.GetCustomAttribute <InjectedAllowedTypesAttribute>();

            //We DO NOT include an existing AllowedTypesAttribute in the merge, because if the AllowedTypesAttribute is used, EPiServer will ONLY
            //look at the AllowedTypesAttribute thus making the validation fail. We can't hook into that method as far as I know so you will need
            //to use the InjectedAllowedTypesAttribute instead of the AllowedTypesAttribute.
            if (customAttributes.Any(x => x is AllowedTypesAttribute))
            {
                var existingAllowedTypesAttribute =
                    customAttributes.FirstOrDefault(x => x is AllowedTypesAttribute) as AllowedTypesAttribute;

                if (injectedAllowedTypesAttribute != null)
                {
                    var mergedAllowedTypesAttribute = InjectedAllowedTypes.MergeAttributes(injectedAllowedTypesAttribute, specifiedAllowedTypesAttribute);
                    customAttributes.Remove(existingAllowedTypesAttribute);
                    customAttributes.Add(mergedAllowedTypesAttribute);
                }
            }
            else
            {
                var mergedAllowedTypesAttribute = InjectedAllowedTypes.MergeAttributes(injectedAllowedTypesAttribute, specifiedAllowedTypesAttribute);

                if (mergedAllowedTypesAttribute != null)
                {
                    customAttributes.Add(mergedAllowedTypesAttribute);
                }
            }
            #endregion

            foreach (var attribute in customAttributes)
            {
                if (attribute is BackingTypeAttribute)
                {
                    var backingTypeAttribute = attribute as BackingTypeAttribute;

                    if (backingTypeAttribute.BackingType != null)
                    {
                        if (!typeof(PropertyData).IsAssignableFrom(backingTypeAttribute.BackingType))
                        {
                            var exceptionMessage = string.Format(CultureInfo.InvariantCulture,
                                                                 "The backing type '{0}' attributed to the property '{1}' on '{2}' does not inherit PropertyData.",
                                                                 backingTypeAttribute.BackingType.FullName, property.Name, property.DeclaringType.Name);
                            throw new TypeMismatchException(exceptionMessage);
                        }

                        if (property.IsAutoVirtualPublic())
                        {
                            ValidateTypeCompability(property, backingTypeAttribute.BackingType);
                        }
                    }
                    propertyDefinitionModel.BackingType = backingTypeAttribute.BackingType;
                }
                else if (attribute is AllowedTypesAttribute)
                {
                    var allowedTypesAttribute = attribute as AllowedTypesAttribute;
                    VerifyAllowedTypesAttribute(allowedTypesAttribute, property);
                }
                else if (attribute is DisplayAttribute)
                {
                    var displayAttribute = attribute as DisplayAttribute;
                    propertyDefinitionModel.DisplayName = displayAttribute.GetName();
                    propertyDefinitionModel.Description = displayAttribute.GetDescription();
                    propertyDefinitionModel.Order       = displayAttribute.GetOrder();
                    propertyDefinitionModel.TabName     = displayAttribute.GetGroupName();
                }
                else if (attribute is ScaffoldColumnAttribute)
                {
                    var scaffoldColumnAttribute = attribute as ScaffoldColumnAttribute;
                    propertyDefinitionModel.AvailableInEditMode = scaffoldColumnAttribute.Scaffold;
                }
                else if (attribute is CultureSpecificAttribute)
                {
                    var specificAttribute = attribute as CultureSpecificAttribute;
                    ThrowIfBlockProperty(specificAttribute, property);
                    propertyDefinitionModel.CultureSpecific = specificAttribute.IsCultureSpecific;
                }
                else if (attribute is RequiredAttribute)
                {
                    var requiredAttribute = attribute as RequiredAttribute;
                    ThrowIfBlockProperty(requiredAttribute, property);
                    propertyDefinitionModel.Required = true;
                }
                else if (attribute is SearchableAttribute)
                {
                    var searchableAttribute = attribute as SearchableAttribute;
                    ThrowIfBlockProperty(searchableAttribute, property);
                    propertyDefinitionModel.Searchable = searchableAttribute.IsSearchable;
                }
                else if (attribute is UIHintAttribute)
                {
                    var uiHintAttribute = attribute as UIHintAttribute;
                    if (!string.IsNullOrEmpty(uiHintAttribute.UIHint))
                    {
                        if (string.Equals(uiHintAttribute.PresentationLayer, "website"))
                        {
                            propertyDefinitionModel.TemplateHint = uiHintAttribute.UIHint;
                        }
                        else if (string.IsNullOrEmpty(uiHintAttribute.PresentationLayer) &&
                                 string.IsNullOrEmpty(propertyDefinitionModel.TemplateHint))
                        {
                            propertyDefinitionModel.TemplateHint = uiHintAttribute.UIHint;
                        }
                    }
                }

                propertyDefinitionModel.Attributes.AddAttribute(attribute);
            }
        }