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); }
/// <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); }
/// <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)); }
/// <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) { }
/// <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; }
/// <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>(); }