public ImportAttributeTarget(PropertyInfo propertyInfo, ImportAttribute attribute) { Ensure.NotNull(propertyInfo, "propertyInfo"); Ensure.NotNull(attribute, "attribute"); Type = propertyInfo.PropertyType; Name = attribute.Name; }
internal void BuildAttributes(Type type, ref List <Attribute> attributes) { Attribute importAttribute; // Infer from Type when not explicitly set. bool asMany = (!_asManySpecified) ? type != s_stringType && typeof(IEnumerable).IsAssignableFrom(type) : _asMany; if (!asMany) { importAttribute = new ImportAttribute(_contractName, _contractType) { AllowDefault = _allowDefault, AllowRecomposition = _allowRecomposition, RequiredCreationPolicy = _requiredCreationPolicy, Source = _source }; } else { importAttribute = new ImportManyAttribute(_contractName, _contractType) { AllowRecomposition = _allowRecomposition, RequiredCreationPolicy = _requiredCreationPolicy, Source = _source }; } if (attributes == null) { attributes = new List <Attribute>(); } attributes.Add(importAttribute); }
public void Ctor_Default() { var attribute = new ImportAttribute(); Assert.Null(attribute.ContractName); Assert.False(attribute.AllowDefault); }
/// <summary> /// Add new Content Types for Pipeline Designer /// </summary> /// <remarks>Some Content Types are defined in EAV but some only in 2sxc. EAV.VersionUpgrade ensures Content Types are shared across all Apps.</remarks> internal void EnsurePipelineDesignerAttributeSets() { logger.LogStep("06.00.00", "EnsurePipelineDesignerAttributeSets start", false); // Ensure DnnSqlDataSource Configuration var dsrcSqlDataSource = ImportAttributeSet.SystemAttributeSet("|Config ToSic.SexyContent.DataSources.DnnSqlDataSource", "used to configure a DNN SqlDataSource", new List <ImportAttribute> { ImportAttribute.StringAttribute("ContentType", "ContentType", null, true), ImportAttribute.StringAttribute("SelectCommand", "SelectCommand", null, true, rowCount: 10) }); // Collect AttributeSets for use in Import var attributeSets = new List <ImportAttributeSet> { dsrcSqlDataSource }; var import = new Import(Constants.DefaultZoneId, Constants.MetaDataAppId, Settings.InternalUserName); import.RunImport(attributeSets, null); var metaDataCtx = EavDataController.Instance(Constants.DefaultZoneId, Constants.MetaDataAppId); metaDataCtx.AttribSet.GetAttributeSet(dsrcSqlDataSource.StaticName).AlwaysShareConfiguration = true; metaDataCtx.SqlDb.SaveChanges(); // Run EAV Version Upgrade (also ensures Content Type sharing) var eavVersionUpgrade = new VersionUpgrade(Settings.InternalUserName); eavVersionUpgrade.EnsurePipelineDesignerAttributeSets(); logger.LogStep("06.00.00", "EnsurePipelineDesignerAttributeSets done", false); }
public void Ctor_ContractName(string contractName) { var attribute = new ImportAttribute(contractName); Assert.Equal(contractName, attribute.ContractName); Assert.False(attribute.AllowDefault); }
private void VerifyImport(ImportAttribute attr, MemberInfo member) { switch (member.MemberType) { case MemberTypes.Constructor: case MemberTypes.Property: case MemberTypes.Method: if (!(attr is ImportCallAttribute)) { throw Guard.ImportFail(); } break; case MemberTypes.Field: if (!(attr is ImportFieldAttribute)) { throw Guard.ImportFail(); } break; default: throw new ArgumentOutOfRangeException(); } }
private static string ResolveIdentifier(ImportAttribute attr, [NotNull] MemberInfo member, out string resolvedId) { Conditions.NotNull(member.DeclaringType, nameof(member.DeclaringType)); if (!IsAnnotated(member.DeclaringType, out var nameSpaceAttr)) { throw Guard.ImportFail(NamespaceError); } // Resolve the symbol resolvedId = attr.Identifier ?? member.Name; string nameSpace = nameSpaceAttr.Namespace; string enclosingNamespace = member.DeclaringType.Name; var options = attr.Options; if (member.MemberType == MemberTypes.Method && attr is ImportCallAttribute callAttr && callAttr.CallOptions.HasFlagFast(ImportCallOptions.Constructor)) { if (!options.HasFlagFast(IdentifierOptions.FullyQualified)) { throw Guard.ImportFail( $"\"{nameof(IdentifierOptions)}\" must be \"{nameof(IdentifierOptions.FullyQualified)}\""); } // return enclosingNamespace + SCOPE_RESOLUTION_OPERATOR + enclosingNamespace; return(Combine(enclosingNamespace, enclosingNamespace)); } if (!options.HasFlagFast(IdentifierOptions.IgnoreEnclosingNamespace)) { // resolvedId = enclosingNamespace + SCOPE_RESOLUTION_OPERATOR + resolvedId; resolvedId = Combine(enclosingNamespace, resolvedId); } if (!options.HasFlagFast(IdentifierOptions.IgnoreNamespace)) { if (nameSpace != null) { // resolvedId = nameSpace + SCOPE_RESOLUTION_OPERATOR + resolvedId; resolvedId = Combine(nameSpace, resolvedId); } } if (options.HasFlagFast(IdentifierOptions.UseAccessorName)) { Conditions.Require(member.MemberType == MemberTypes.Method); resolvedId = resolvedId.Replace(GET_PROPERTY_PREFIX, GET_PROPERTY_REPLACEMENT); } Conditions.NotNull(resolvedId, nameof(resolvedId)); return(resolvedId); }
private static string ResolveIdentifier(ImportAttribute attr, [NotNull] MemberInfo member, out string resolvedId) { Guard.AssertNotNull(member.DeclaringType, nameof(member.DeclaringType)); CheckAnnotations(member, true, out var nameSpaceAttr); // Resolve the symbol resolvedId = attr.Identifier ?? member.Name; string nameSpace = nameSpaceAttr.Namespace; string enclosingNamespace = member.DeclaringType.Name; var options = attr.Options; bool isMethod = member.MemberType == MemberTypes.Method; bool isCallAttr = attr is ImportCallAttribute; if (isCallAttr) { var callAttr = (ImportCallAttribute)attr; bool isCtor = callAttr.CallOptions.HasFlagFast(ImportCallOptions.Constructor); if (isMethod && isCtor) { CheckConstructorOptions(options); return(ScopeJoin(new[] { enclosingNamespace, enclosingNamespace })); } } if (!options.HasFlagFast(IdentifierOptions.IgnoreEnclosingNamespace)) { resolvedId = ScopeJoin(new[] { enclosingNamespace, resolvedId }); } if (!options.HasFlagFast(IdentifierOptions.IgnoreNamespace)) { if (nameSpace != null) { resolvedId = ScopeJoin(new[] { nameSpace, resolvedId }); } } if (options.HasFlagFast(IdentifierOptions.UseAccessorName)) { Guard.Assert(member.MemberType == MemberTypes.Method); resolvedId = resolvedId.Replace(UniqueMember.Get.Value, GET_PROPERTY_REPLACEMENT); } Guard.AssertNotNull(resolvedId, nameof(resolvedId)); return(resolvedId); }
public ImportDefinitionBuilder(ImportAttribute import, Type actualType, Action <object, object> setter) { _import = import; _actualType = actualType; _setter = setter; _elementType = ElementType(); _isLazyType = IsLazyType(_elementType); _contractType = ContractType(); }
public ImportDefinitionBuilder(ImportAttribute import, Type actualType, Action<object, object> setter) { _import = import; _actualType = actualType; _setter = setter; _elementType = ElementType(); _isLazyType = IsLazyType(_elementType); _contractType = ContractType(); }
public void AsContractName_AndContractType_ComputeContractNameFromType() { var builder = new ConventionBuilder(); builder.ForType <FooImpl>().ImportProperty((p) => p.IFooProperty, c => c.AsContractName(t => "Contract:" + t.FullName)); ImportAttribute importAtt = GetImportAttribute(builder); Assert.Equal("Contract:" + typeof(IFoo).FullName, importAtt.ContractName); }
public void AsContractName_AndContractType_SetsContractNameAndType() { var builder = new ConventionBuilder(); builder.ForType <FooImpl>().ImportProperty((p) => p.IFooProperty, (c) => c.AsContractName("hey")); ImportAttribute importAtt = GetImportAttribute(builder); Assert.Equal("hey", importAtt.ContractName); }
public void AllowDefault_SetsAllowDefaultProperty() { var builder = new ConventionBuilder(); builder.ForType <FooImpl>().ImportProperty((p) => p.IFooProperty, (c) => c.AllowDefault()); ImportAttribute importAtt = GetImportAttribute(builder); Assert.True(importAtt.AllowDefault); Assert.Null(importAtt.ContractName); }
public void AsContractName_AndContractType_SetsContractNameAndType() { var builder = new ImportBuilder(); builder.AsContractName("hey"); builder.AsContractType(typeof(IFoo)); ImportAttribute importAtt = GetImportAttribute(builder); Assert.Equal("hey", importAtt.ContractName); Assert.Equal(typeof(IFoo), importAtt.ContractType); }
public void AllowRecomposition_SetsAllowRecompositionProperty() { var builder = new ImportBuilder(); builder.AllowRecomposition(); ImportAttribute importAtt = GetImportAttribute(builder); Assert.True(importAtt.AllowRecomposition); Assert.Null(importAtt.ContractType); Assert.Null(importAtt.ContractName); }
private static ImportDefinition FromMember(MemberInfo member, ImportAttribute import) { var property = member as PropertyInfo; if (property != null) return FromProperty(property, import); var field = member as FieldInfo; if (field != null) return FromField(field, import); throw new CompositionException(new CompositionError(import.ContractType, string.Format("Unsupported import `{0}'.", member))); }
public void AsContractTypeOfT_SetsContractType() { var builder = new ImportBuilder(); builder.AsContractType <IFoo>(); ImportAttribute importAtt = GetImportAttribute(builder); Assert.Equal(typeof(IFoo), importAtt.ContractType); Assert.Null(importAtt.ContractName); Assert.False(importAtt.AllowDefault); Assert.False(importAtt.AllowRecomposition); }
public void AsContractName_SetsContractName() { var builder = new ImportBuilder(); builder.AsContractName("hey"); ImportAttribute importAtt = GetImportAttribute(builder); Assert.Equal("hey", importAtt.ContractName); Assert.False(importAtt.AllowDefault); Assert.False(importAtt.AllowRecomposition); Assert.Null(importAtt.ContractType); }
public void RequiredCreationPolicy_SetsRequiredCreationPolicyProperty() { var builder = new ImportBuilder(); builder.RequiredCreationPolicy(CreationPolicy.NonShared); ImportAttribute importAtt = GetImportAttribute(builder); Assert.Equal(CreationPolicy.NonShared, importAtt.RequiredCreationPolicy); Assert.False(importAtt.AllowDefault); Assert.False(importAtt.AllowRecomposition); Assert.Null(importAtt.ContractType); Assert.Null(importAtt.ContractName); }
public IEnumerable <IDependencyImportDescriptor> GetImports(Type taskType) { List <IDependencyImportDescriptor> result = new List <IDependencyImportDescriptor>(); foreach (PropertyInfo propertyInfo in taskType.GetProperties()) { ImportAttribute attribute = propertyInfo.GetCustomAttribute <ImportAttribute>(); if (attribute != null) { result.Add(new PropertyImportDescriptor(new ImportAttributeTarget(propertyInfo, attribute), propertyInfo)); } } return(result); }
private static void FindOptimization(ImportAttribute import, MemberInfo mem) { if (import is ImportCallAttribute callAttr && !(callAttr is ImportAccessorAttribute)) { bool warn = callAttr.CallOptions == ImportCallOptions.Map && callAttr.Options == IdentifierOptions.UseAccessorName; if (warn) { Global.Value.WriteWarning(null, "Use {Name} on member {Member} in {Type}", nameof(ImportAccessorAttribute), mem.Name, mem.DeclaringType?.Name); } } }
private List <ImportAttributeSet> GetImportAttributeSets(IEnumerable <XElement> xAttributeSets) { var importAttributeSets = new List <ImportAttributeSet>(); // Loop through AttributeSets foreach (var attributeSet in xAttributeSets) { var attributes = new List <ImportAttribute>(); var titleAttribute = new ImportAttribute(); var attsetElem = attributeSet.Element(XmlConstants.Attributes); if (attsetElem != null) { foreach (var xElementAttribute in attsetElem.Elements(XmlConstants.Attribute)) { var attribute = new ImportAttribute { StaticName = xElementAttribute.Attribute("StaticName").Value, Type = xElementAttribute.Attribute("Type").Value, AttributeMetaData = GetImportEntities(xElementAttribute.Elements(XmlConstants.Entity), Constants.MetadataForField)//.AssignmentObjectTypeIdFieldProperties) }; attributes.Add(attribute); // Set Title Attribute if (Parse(xElementAttribute.Attribute("IsTitle").Value)) { titleAttribute = attribute; } } } // Add AttributeSet importAttributeSets.Add(new ImportAttributeSet { StaticName = attributeSet.Attribute(Const2.Static).Value, Name = attributeSet.Attribute(Const2.Name).Value, Description = attributeSet.Attribute(Const2.Description).Value, Attributes = attributes, Scope = attributeSet.Attributes(Const2.Scope).Any() ? attributeSet.Attribute(Const2.Scope).Value : Settings.AttributeSetScope, AlwaysShareConfiguration = AllowSystemChanges && attributeSet.Attributes(Const2.AlwaysShareConfig).Any() && Parse(attributeSet.Attribute(Const2.AlwaysShareConfig).Value), UsesConfigurationOfAttributeSet = attributeSet.Attributes("UsesConfigurationOfAttributeSet").Any() ? attributeSet.Attribute("UsesConfigurationOfAttributeSet").Value : "", TitleAttribute = titleAttribute, SortAttributes = attributeSet.Attributes(Const2.SortAttributes).Any() && bool.Parse(attributeSet.Attribute(Const2.SortAttributes).Value) }); } return(importAttributeSets); }
private void LoadMethod(ImportAttribute attr, MethodInfo method, Pointer <byte> addr) { var callAttr = attr as ImportCallAttribute; Conditions.NotNull(callAttr, nameof(callAttr)); var options = callAttr.CallOptions; if (options == ImportCallOptions.None) { throw Guard.ImportFail("You must specify an option"); } bool bind = options.HasFlagFast(ImportCallOptions.Bind); bool addToMap = options.HasFlagFast(ImportCallOptions.Map); if (bind && addToMap) { throw Guard.ImportFail( $"The option {ImportCallOptions.Bind} cannot be used with {ImportCallOptions.Map}"); } if (bind) { // Global.Value.Log.Warning("Binding {Name}", method.Name); FunctionFactory.Managed.SetEntryPoint(method, addr); } if (addToMap) { var enclosing = method.DeclaringType; if (enclosing == null) { throw Guard.AmbiguousFail(); } var name = method.Name; if (name.StartsWith(GET_PROPERTY_PREFIX)) { // The nameof operator does not return the name with the get prefix name = name.Erase(GET_PROPERTY_PREFIX); } m_typeImportMaps[enclosing].Add(name, addr); } }
internal void BuildAttributes(Type type, ref List <Attribute> attributes) { Attribute importAttribute; var contractName = (_getContractNameFromPartType != null) ? _getContractNameFromPartType(type) : _contractName; // Infer from Type when not explicitly set. var asMany = _asMany ?? IsSupportedImportManyType(type.GetTypeInfo()); if (!asMany) { importAttribute = new ImportAttribute(contractName) { AllowDefault = _allowDefault }; } else { importAttribute = new ImportManyAttribute(contractName); } if (attributes == null) { attributes = new List <Attribute>(); } attributes.Add(importAttribute); //Add metadata attributes from direct specification if (_metadataConstraintItems != null) { foreach (Tuple <string, object> item in _metadataConstraintItems) { attributes.Add(new ImportMetadataConstraintAttribute(item.Item1, item.Item2)); } } //Add metadata attributes from func specification if (_metadataConstraintItemFuncs != null) { foreach (Tuple <string, Func <Type, object> > item in _metadataConstraintItemFuncs) { var name = item.Item1; var value = (item.Item2 != null) ? item.Item2(type) : null; attributes.Add(new ImportMetadataConstraintAttribute(name, value)); } } return; }
public void ComposeImport(PropertyInfo p, Object target, ImportAttribute att) { if (p != null && target != null && att != null) { var r = from part in _catalog.Parts from d in part.ExportDefinitions.Where(k => k.Key == att.ContractType).Select(k => k.Value) from i in d select i; var targettype = r.FirstOrDefault(); if (targettype != null) { p.SetValue(target, Convert.ChangeType(Activator.CreateInstance(targettype), att.ContractType, null), null); } } }
private bool MatchesImport([NotNull] ExportDefinition exportDefinition, [NotNull] ImportAttribute importAttribute) { Debug.ArgumentNotNull(exportDefinition, nameof(exportDefinition)); Debug.ArgumentNotNull(importAttribute, nameof(importAttribute)); if (importAttribute.ContractType != null && importAttribute.ContractType != exportDefinition.Attribute.ContractType) { return(false); } if (importAttribute.ContractName != null && importAttribute.ContractName != exportDefinition.Attribute.ContractName) { return(false); } return(true); }
private static ImportDefinition FromMember(MemberInfo member, ImportAttribute import) { var property = member as PropertyInfo; if (property != null) { return(FromProperty(property, import)); } var field = member as FieldInfo; if (field != null) { return(FromField(field, import)); } throw new CompositionException(new CompositionError(import.ContractType, string.Format("Unsupported import `{0}'.", member))); }
private void LoadField <T>(ref T value, IImportProvider ip, string identifier, MetaField field, ImportAttribute attr) { var ifld = (ImportFieldAttribute)attr; Pointer <byte> ptr = ip.GetAddress(identifier); var options = ifld.FieldOptions; Pointer <byte> fieldAddr = field.GetValueAddress(ref value); object fieldValue; Global.Value.WriteDebug(Id, "Loading field {Id} with {Option}", field.Name, options); switch (options) { case ImportFieldOptions.CopyIn: fieldValue = CopyInField(ifld, field, ptr); break; case ImportFieldOptions.Proxy: fieldValue = ProxyLoadField(ifld, field, ptr); break; case ImportFieldOptions.Fast: FastLoadField(field, ptr, fieldAddr); return; default: throw new ArgumentOutOfRangeException(); } if (field.FieldType.IsAnyPointer) { ptr.WritePointer((Pointer <byte>)fieldValue); } else { ptr.WriteAny(field.FieldType.RuntimeType, fieldValue); } }
private static ImportDefinition FromProperty(PropertyInfo p, ImportAttribute import) { return ImportDefinitionFrom(import, p.PropertyType, (part, value) => p.SetValue(part, value, null)); }
private bool TryCreateImportDefinition(Type importingType, ICustomAttributeProvider member, [NotNullWhen(true)] out ImportDefinition?importDefinition) { Requires.NotNull(importingType, nameof(importingType)); Requires.NotNull(member, nameof(member)); ImportAttribute importAttribute = member.GetFirstAttribute <ImportAttribute>(); ImportManyAttribute importManyAttribute = member.GetFirstAttribute <ImportManyAttribute>(); // Importing constructors get implied attributes on their parameters. if (importAttribute == null && importManyAttribute == null && member is ParameterInfo) { importAttribute = new ImportAttribute(); } if (importAttribute != null) { this.ThrowOnInvalidImportingMemberOrParameter(member, isImportMany: false); if (importAttribute.Source != ImportSource.Any) { throw new NotSupportedException(Strings.CustomImportSourceNotSupported); } var requiredCreationPolicy = importingType.IsExportFactoryTypeV1() ? CreationPolicy.NonShared : (CreationPolicy)importAttribute.RequiredCreationPolicy; Type contractType = importAttribute.ContractType ?? GetTypeIdentityFromImportingType(importingType, importMany: false); var constraints = PartCreationPolicyConstraint.GetRequiredCreationPolicyConstraints(requiredCreationPolicy) .Union(this.GetMetadataViewConstraints(importingType, importMany: false)) .Union(GetExportTypeIdentityConstraints(contractType)); importDefinition = new ImportDefinition( string.IsNullOrEmpty(importAttribute.ContractName) ? GetContractName(contractType) : importAttribute.ContractName, importAttribute.AllowDefault ? ImportCardinality.OneOrZero : ImportCardinality.ExactlyOne, GetImportMetadataForGenericTypeImport(contractType), constraints); return(true); } else if (importManyAttribute != null) { this.ThrowOnInvalidImportingMemberOrParameter(member, isImportMany: true); if (importManyAttribute.Source != ImportSource.Any) { throw new NotSupportedException(Strings.CustomImportSourceNotSupported); } var requiredCreationPolicy = GetElementTypeFromMany(importingType).IsExportFactoryTypeV1() ? CreationPolicy.NonShared : (CreationPolicy)importManyAttribute.RequiredCreationPolicy; Type contractType = importManyAttribute.ContractType ?? GetTypeIdentityFromImportingType(importingType, importMany: true); var constraints = PartCreationPolicyConstraint.GetRequiredCreationPolicyConstraints(requiredCreationPolicy) .Union(this.GetMetadataViewConstraints(importingType, importMany: true)) .Union(GetExportTypeIdentityConstraints(contractType)); importDefinition = new ImportDefinition( string.IsNullOrEmpty(importManyAttribute.ContractName) ? GetContractName(contractType) : importManyAttribute.ContractName, ImportCardinality.ZeroOrMore, GetImportMetadataForGenericTypeImport(contractType), constraints); return(true); } else { importDefinition = null; return(false); } }
private bool TryCreateImportDefinition(Type importingType, ICustomAttributeProvider member, ImmutableHashSet <IImportSatisfiabilityConstraint> importConstraints, [NotNullWhen(true)] out ImportDefinition?importDefinition) { Requires.NotNull(importingType, nameof(importingType)); Requires.NotNull(member, nameof(member)); var importAttribute = member.GetFirstAttribute <ImportAttribute>(); var importManyAttribute = member.GetFirstAttribute <ImportManyAttribute>(); // Importing constructors get implied attributes on their parameters. if (importAttribute == null && importManyAttribute == null && member is ParameterInfo) { importAttribute = new ImportAttribute(); } var sharingBoundaries = ImmutableHashSet.Create <string>(); var sharingBoundaryAttribute = member.GetFirstAttribute <SharingBoundaryAttribute>(); if (sharingBoundaryAttribute != null) { Verify.Operation(importingType.IsExportFactoryTypeV2(), Strings.IsExpectedOnlyOnImportsOfExportFactoryOfT, typeof(SharingBoundaryAttribute).Name); sharingBoundaries = sharingBoundaries.Union(sharingBoundaryAttribute.SharingBoundaryNames); } if (member is PropertyInfo importingMember && importingMember.SetMethod == null) { // MEFv2 quietly ignores such importing members. importDefinition = null; return(false); } if (importAttribute != null) { this.ThrowOnInvalidImportingMemberOrParameter(member, isImportMany: false); Type contractType = GetTypeIdentityFromImportingType(importingType, importMany: false); if (contractType.IsAnyLazyType() || contractType.IsExportFactoryTypeV2()) { contractType = contractType.GetTypeInfo().GetGenericArguments()[0]; } importConstraints = importConstraints .Union(this.GetMetadataViewConstraints(importingType, importMany: false)) .Union(GetExportTypeIdentityConstraints(contractType)); importDefinition = new ImportDefinition( string.IsNullOrEmpty(importAttribute.ContractName) ? GetContractName(contractType) : importAttribute.ContractName, importAttribute.AllowDefault ? ImportCardinality.OneOrZero : ImportCardinality.ExactlyOne, GetImportMetadataForGenericTypeImport(contractType), importConstraints, sharingBoundaries); return(true); } else if (importManyAttribute != null) { this.ThrowOnInvalidImportingMemberOrParameter(member, isImportMany: true); Type contractType = GetTypeIdentityFromImportingType(importingType, importMany: true); importConstraints = importConstraints .Union(this.GetMetadataViewConstraints(importingType, importMany: true)) .Union(GetExportTypeIdentityConstraints(contractType)); importDefinition = new ImportDefinition( string.IsNullOrEmpty(importManyAttribute.ContractName) ? GetContractName(contractType) : importManyAttribute.ContractName, ImportCardinality.ZeroOrMore, GetImportMetadataForGenericTypeImport(contractType), importConstraints, sharingBoundaries); return(true); } else { importDefinition = null; return(false); } }
/// <summary> /// Initializes a new instance of the <see cref="ImportModel"/> class. /// </summary> /// <param name="att">The att.</param> public ImportModel(ImportAttribute att) { this.att = att; }
private void AppendImport(ImportAttribute attribute) { xml.AppendFormat("<import class=\"{0}\" rename=\"{1}\"/>", XmlGenerationVisitor.MakeTypeName(attribute.Type), attribute.Rename); }
private static ImportDefinition FromField(FieldInfo fieldInfo, ImportAttribute import) { return ImportDefinitionFrom(import, fieldInfo.FieldType, fieldInfo.SetValue); }
private static ImportDefinition ImportDefinitionFrom(ImportAttribute import, Type actualType, Action<object, object> setter) { return new ImportDefinitionBuilder(import, actualType, setter).Build(); }