예제 #1
0
        /// <summary>
        /// Applies EPM mapping to the specified entity type on the model and returns it for composablity.
        /// </summary>
        /// <param name="model">Model to use</param>
        /// <param name="entityTypeName">Entity type name</param>
        /// <param name="sourcePath">Source path</param>
        /// <param name="targetSyndicationItem">TargetSyndicationItem to use</param>
        /// <param name="targetTextContentKind">TargetTextContentKind to use</param>
        /// <param name="keepInContent">true to keep the mapped value in content; otherwise false (defaults to true).</param>
        /// <returns>Enity Model Schema with the mapping applied</returns>
        public static EntityModelSchema EntityPropertyMapping(
            this EntityModelSchema model,
            string entityTypeName,
            string sourcePath,
            SyndicationItemProperty targetSyndicationItem    = SyndicationItemProperty.AuthorName,
            SyndicationTextContentKind targetTextContentKind = SyndicationTextContentKind.Plaintext,
            bool keepInContent = true)
        {
            ExceptionUtilities.CheckArgumentNotNull(model, "model");
            ExceptionUtilities.CheckArgumentNotNull(entityTypeName, "entityTypeName");
            ExceptionUtilities.CheckArgumentNotNull(sourcePath, "sourcePath");
            var entityType = model.GetEntityType(entityTypeName);

            ExceptionUtilities.CheckObjectNotNull(entityType, "There are no entity types matching the name:{0} in the model", entityTypeName);
            entityType.EntityPropertyMapping(sourcePath, targetSyndicationItem, targetTextContentKind, keepInContent);

            return(model);
        }