internal ConfigurationRepository Build() { var repository = new ConfigurationRepository(); foreach (var globalSubstitution in GlobalSubstitutions) { repository.GlobalSubstitutions[globalSubstitution.Key] = globalSubstitution.Value; } foreach (var kv in _typeConfigurationBuilders) { var cls = kv.Value as IClassConfigurationBuilder; var intrf = kv.Value as IInterfaceConfigurationBuilder; if (cls != null) { repository.AttributesForType[kv.Key] = cls.AttributePrototype; repository.DecoratorsForType[kv.Key] = new List <TsDecoratorAttribute>(cls.Decorators); if (cls.Substitutions.Count > 0) { repository.TypeSubstitutions[kv.Key] = cls.Substitutions; } } if (intrf != null) { repository.AttributesForType[kv.Key] = intrf.AttributePrototype; if (intrf.Substitutions.Count > 0) { repository.TypeSubstitutions[kv.Key] = intrf.Substitutions; } } foreach (var kvm in kv.Value.MembersConfiguration) { if (kvm.Value.CheckIgnored()) { repository.Ignored.Add(kvm.Key); continue; } var prop = kvm.Key as PropertyInfo; var field = kvm.Key as FieldInfo; var method = kvm.Key as MethodInfo; if (prop != null) { repository.AttributesForProperties[prop] = (TsPropertyAttribute)kvm.Value.AttributePrototype; } if (field != null) { repository.AttributesForFields[field] = (TsPropertyAttribute)kvm.Value.AttributePrototype; } if (method != null) { repository.AttributesForMethods[method] = (TsFunctionAttribute)kvm.Value.AttributePrototype; } var dec = kvm.Value as IDecoratorsAggregator; if (dec != null) { if (!repository.DecoratorsForMember.ContainsKey(kvm.Key)) { repository.DecoratorsForMember[kvm.Key] = new List <TsDecoratorAttribute>(); } repository.DecoratorsForMember[kvm.Key].AddRange(dec.Decorators); } } foreach (var kvp in kv.Value.ParametersConfiguration) { if (kvp.Value.CheckIgnored()) { repository.Ignored.Add(kvp.Key); continue; } repository.AttributesForParameters[kvp.Key] = kvp.Value.AttributePrototype; } repository.AddFileSeparationSettings(kv.Key, kv.Value); } foreach (var kv in _enumConfigurationBuilders) { repository.AttributesForType[kv.Key] = kv.Value.AttributePrototype; foreach (var enumValueExportConfiguration in kv.Value.ValueExportConfigurations) { repository.AttributesForEnumValues[enumValueExportConfiguration.Key] = enumValueExportConfiguration.Value.AttributePrototype; } repository.AddFileSeparationSettings(kv.Key, kv.Value); repository.DecoratorsForType[kv.Key] = new List <TsDecoratorAttribute>(kv.Value.Decorators); } repository.References.AddRange(_references); repository.Imports.AddRange(_imports); repository.AdditionalDocumentationPathes.AddRange(_additionalDocumentationPathes); return(repository); }
internal ConfigurationRepository Build() { var repository = new ConfigurationRepository(); foreach (var kv in _typeConfigurationBuilders) { var cls = kv.Value as IClassConfigurationBuilder; var intrf = kv.Value as IInterfaceConfigurationBuilder; if (cls != null) { repository.AttributesForType[kv.Key] = cls.AttributePrototype; } if (intrf != null) { repository.AttributesForType[kv.Key] = intrf.AttributePrototype; } foreach (var kvm in kv.Value.MembersConfiguration) { if (kvm.Value.CheckIgnored()) { repository.Ignored.Add(kvm.Key); continue; } var prop = kvm.Key as PropertyInfo; var field = kvm.Key as FieldInfo; var method = kvm.Key as MethodInfo; if (prop != null) { repository.AttributesForProperties[prop] = (TsPropertyAttribute)kvm.Value.AttributePrototype; } if (field != null) { repository.AttributesForFields[field] = (TsPropertyAttribute)kvm.Value.AttributePrototype; } if (method != null) { repository.AttributesForMethods[method] = (TsFunctionAttribute)kvm.Value.AttributePrototype; } } foreach (var kvp in kv.Value.ParametersConfiguration) { if (kvp.Value.CheckIgnored()) { repository.Ignored.Add(kvp.Key); continue; } repository.AttributesForParameters[kvp.Key] = kvp.Value.AttributePrototype; } repository.AddFileSeparationSettings(kv.Key, kv.Value); } foreach (var kv in _enumConfigurationBuilders) { repository.AttributesForType[kv.Key] = kv.Value.AttributePrototype; foreach (var enumValueExportConfiguration in kv.Value.ValueExportConfigurations) { repository.AttributesForEnumValues[enumValueExportConfiguration.Key] = enumValueExportConfiguration.Value.AttributePrototype; } repository.AddFileSeparationSettings(kv.Key, kv.Value); } repository.References.AddRange(_references); repository.AdditionalDocumentationPathes.AddRange(_additionalDocumentationPathes); return(repository); }
internal ConfigurationRepository Build() { var repository = new ConfigurationRepository(); foreach (var kv in _typeConfigurationBuilders) { var cls = kv.Value as IClassConfigurationBuilder; var intrf = kv.Value as IInterfaceConfigurationBuilder; if (cls != null) { repository.AttributesForType[kv.Key] = cls.AttributePrototype; } if (intrf != null) { repository.AttributesForType[kv.Key] = intrf.AttributePrototype; } foreach (var kvm in kv.Value.MembersConfiguration) { if (kvm.Value.CheckIgnored()) { repository.Ignored.Add(kvm.Key); continue; } var prop = kvm.Key as PropertyInfo; var field = kvm.Key as FieldInfo; var method = kvm.Key as MethodInfo; if (prop != null) { repository.AttributesForProperties[prop] = (TsPropertyAttribute) kvm.Value.AttributePrototype; } if (field != null) { repository.AttributesForFields[field] = (TsPropertyAttribute) kvm.Value.AttributePrototype; } if (method != null) { repository.AttributesForMethods[method] = (TsFunctionAttribute) kvm.Value.AttributePrototype; } } foreach (var kvp in kv.Value.ParametersConfiguration) { if (kvp.Value.CheckIgnored()) { repository.Ignored.Add(kvp.Key); continue; } repository.AttributesForParameters[kvp.Key] = kvp.Value.AttributePrototype; } repository.AddFileSeparationSettings(kv.Key, kv.Value); } foreach (var kv in _enumConfigurationBuilders) { repository.AttributesForType[kv.Key] = kv.Value.AttributePrototype; foreach (var enumValueExportConfiguration in kv.Value.ValueExportConfigurations) { repository.AttributesForEnumValues[enumValueExportConfiguration.Key] = enumValueExportConfiguration.Value.AttributePrototype; } repository.AddFileSeparationSettings(kv.Key, kv.Value); } repository.References.AddRange(_references); repository.AdditionalDocumentationPathes.AddRange(_additionalDocumentationPathes); return repository; }