コード例 #1
0
        public void CollectionsMap()
        {
            var definitions = new MapDefinitionCollection(new IMapDefinition[]
            {
                new MapperDefinition2(),
            });
            var mapper = new UmbracoMapper(definitions, _scopeProvider);

            // can map a PropertyCollection
            var source = new PropertyCollection();
            var target = mapper.Map <IEnumerable <ContentPropertyDto> >(source);
        }
コード例 #2
0
ファイル: ContentBase.cs プロジェクト: jraghu24/Rraghu
        /// <summary>
        /// Protected constructor for ContentBase (Base for Content and Media)
        /// </summary>
        /// <param name="name">Localized Name of the entity</param>
        /// <param name="parent"></param>
        /// <param name="contentType"></param>
        /// <param name="properties"></param>
        protected ContentBase(string name, IContentBase parent, IContentTypeComposition contentType, PropertyCollection properties)
        {
            Mandate.ParameterNotNull(parent, "parent");
            Mandate.ParameterNotNull(contentType, "contentType");
            Mandate.ParameterNotNull(properties, "properties");

            ContentTypeBase = contentType;
            Version         = Guid.NewGuid();

            _parentId      = new Lazy <int>(() => parent.Id);
            _name          = name;
            _contentTypeId = int.Parse(contentType.Id.ToString(CultureInfo.InvariantCulture));
            _properties    = properties;
            _properties.EnsurePropertyTypes(PropertyTypes);
        }
コード例 #3
0
ファイル: Media.cs プロジェクト: bharanijayasuri/umbraco8
 /// <summary>
 /// Constructor for creating a Media object
 /// </summary>
 /// <param name="name">Name of the Media object</param>
 /// <param name="parentId">Id of the Parent IMedia</param>
 /// <param name="contentType">MediaType for the current Media object</param>
 /// <param name="properties">Collection of properties</param>
 public Media(string name, int parentId, IMediaType contentType, PropertyCollection properties)
     : base(name, parentId, contentType, properties)
 {
     _contentType = contentType ?? throw new ArgumentNullException(nameof(contentType));
 }
コード例 #4
0
 /// <summary>
 /// Constructor for creating a Media object
 /// </summary>
 /// <param name="name">Name of the Media object</param>
 /// <param name="parentId">Id of the Parent IMedia</param>
 /// <param name="contentType">MediaType for the current Media object</param>
 /// <param name="properties">Collection of properties</param>
 public Media(string name, int parentId, IMediaType contentType, PropertyCollection properties)
     : base(name, parentId, contentType, properties)
 {
 }
コード例 #5
0
ファイル: Media.cs プロジェクト: KerwinMa/Umbraco
 /// <summary>
 /// Constructor for creating a Media object
 /// </summary>
 /// <param name="name">Name of the Media object</param>
 /// <param name="parentId">Id of the Parent IMedia</param>
 /// <param name="contentType">MediaType for the current Media object</param>
 /// <param name="properties">Collection of properties</param>
 public Media(string name, int parentId, IMediaType contentType, PropertyCollection properties)
     : base(name, parentId, contentType, properties)
 {
     Mandate.ParameterNotNull(contentType, "contentType");
     _contentType = contentType;
 }
コード例 #6
0
        /// <summary>
        /// Protected constructor for ContentBase (Base for Content and Media)
        /// </summary>
        /// <param name="name">Localized Name of the entity</param>
        /// <param name="parent"></param>
        /// <param name="contentType"></param>
        /// <param name="properties"></param>
        protected ContentBase(string name, IContentBase parent, IContentTypeComposition contentType, PropertyCollection properties)
        {
            Mandate.ParameterNotNull(parent, "parent");
            Mandate.ParameterNotNull(contentType, "contentType");
            Mandate.ParameterNotNull(properties, "properties");

            ContentTypeBase = contentType;
            Version         = Guid.NewGuid();

            _parentId      = new Lazy <int>(() => parent.Id);
            _name          = name;
            _contentTypeId = contentType.Id;
            _properties    = properties;
            _properties.EnsurePropertyTypes(PropertyTypes);
            _additionalData = new Dictionary <string, object>();
        }