Beispiel #1
0
        /// <summary>
        /// Creates an instance of IElementCreationContext
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="elementTypeId">The type of element.</param>
        /// <param name="data">Optional data.</param>
        /// <returns></returns>
        public static IElementCreationContext CreateElementCreationContext(this IElementOwner owner, Guid elementTypeId, string data = null)
        {
            var factory = owner.Context.ElementFactoryManager.GetFactory(elementTypeId);

            var context = new ElementCreationContext(owner, data, factory);

            return(context);
        }
Beispiel #2
0
        public static IElement CreateElement(this IElementOwner owner, IElementFactory factory)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            var context = new ElementCreationContext(owner, null, factory);

            return(factory.Create(context));
        }