Пример #1
0
        /// <summary>
        /// Add many import of given type.
        /// </summary>
        /// <param name="importType">Type of the import.</param>
        /// <param name="itemType">Type of the item.</param>
        /// <param name="setterName">Name of the setter.</param>
        public void AddManyImport(TypeDescriptor importType, TypeDescriptor itemType, string setterName)
        {
            var setterID       = getSetterID(importType, setterName);
            var importTypeInfo = ImportTypeInfo.ParseFromMany(importType, itemType);

            AddImport(importTypeInfo, setterID, null, true);
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Import"/> class.
 /// </summary>
 /// <param name="importTypeInfo">The import type information.</param>
 /// <param name="setter">The setter.</param>
 /// <param name="contract">The contract.</param>
 /// <param name="allowMany">if set to <c>true</c> [allow many].</param>
 /// <param name="allowDefault">if set to <c>true</c> [allow default].</param>
 public Import(ImportTypeInfo importTypeInfo, MethodID setter, string contract, bool allowMany = false, bool allowDefault = false)
 {
     ImportTypeInfo = importTypeInfo;
     Contract       = contract;
     Setter         = setter;
     AllowMany      = allowMany;
     AllowDefault   = allowDefault;
 }
Пример #3
0
        /// <summary>
        /// Add prerequisity import of given type.
        /// </summary>
        /// <param name="type">Type of import.</param>
        private void addPreImport(TypeDescriptor type)
        {
            var importTypeInfo = ImportTypeInfo.ParseFromMany(type, false, null);
            var contract       = importTypeInfo.ItemType.TypeName;
            var preImport      = new Import(importTypeInfo, null, contract);

            _imports.Add(preImport);
        }
Пример #4
0
        /// <summary>
        /// Add import of given type.
        /// </summary>
        /// <param name="importType">Imported type.</param>
        /// <param name="setterName">Name of property.</param>
        public void AddPropertyImport(TypeDescriptor importType, string setterName)
        {
            var setterID       = getSetterID(importType, setterName);
            var importTypeInfo = ImportTypeInfo.ParseFromMany(importType, false, null);
            var contract       = importTypeInfo.ItemType.TypeName;

            AddImport(importTypeInfo, setterID, contract);
        }
Пример #5
0
        /// <summary>
        /// Add import of given type.
        /// </summary>
        /// <param name="importTypeInfo">Info about imported type.</param>
        /// <param name="setterID">Importing setter.</param>
        /// <param name="contract">Contract of import.</param>
        /// <param name="allowMany">Determine many values can be imported.</param>
        /// <param name="allowDefault">if set to <c>true</c> [allow default].</param>
        public void AddImport(ImportTypeInfo importTypeInfo, MethodID setterID, string contract = null, bool allowMany = false, bool allowDefault = false)
        {
            if (contract == null)
            {
                contract = importTypeInfo.ItemType.TypeName;
            }

            var import = new Import(importTypeInfo, setterID, contract, allowMany, allowDefault);

            AddImport(import);
        }