protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector) { var assembly = pluginConfiguration.InfrastructureAssembly; pluginInspector.Log("Configuring assembly {0}", assembly.GetName().Name); foreach (var instance in assembly.GetExportedTypes().Where(tipo => tipo.BaseType == typeof(Profile)).Select(tipo => (Profile)tipo.Assembly.CreateInstance(tipo.FullName))) { Mapper.AddProfile(instance); pluginInspector.Log("Adding profile instance {0}", instance.GetType()); } Mapper.AssertConfigurationIsValid(); }
private void AutoRegister(Assembly interfacesAssembly, Assembly implementationsAssembly, bool useInterception, PluginInspector pluginInspector) { var implementationTypes = implementationsAssembly.GetExportedTypes(); var interfaceTypes = interfacesAssembly.GetExportedTypes(); foreach (var interfaceType in interfaceTypes) { if (!interfaceType.IsInterface) { continue; } var type = interfaceType; var concreteType = Array.Find(implementationTypes, t => type.IsAssignableFrom(t) && !type.Equals(t)); if (concreteType == null) { continue; } pluginInspector.Log("Interface {0} are mapped to {1}, {2} using interception", interfaceType.FullName, concreteType.FullName, useInterception ? string.Empty : "NOT"); _registeredTypes.Add(interfaceType, new TypeRegistry(concreteType, useInterception)); } }
protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector) { var assembly = pluginConfiguration.InfrastructureAssembly; foreach (var validator in from tipo in assembly.GetExportedTypes() where tipo.BaseType != null && tipo.BaseType.IsGenericType && tipo.BaseType.GetGenericTypeDefinition() == typeof(ValidationRuleSet<>) select tipo.Assembly.CreateInstance(tipo.FullName)) { AddValidator(validator); pluginInspector.Log("Adding validator for {0}", validator.GetType().Name); } }
protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector) { var assembly = pluginConfiguration.InfrastructureAssembly; foreach (var mapRule in from tipo in assembly.GetExportedTypes() where tipo.BaseType == typeof(MapRule) select tipo.Assembly.CreateInstance(tipo.FullName)) { AddMapRule((MapRule) mapRule); pluginInspector.Log("Adding MapRule for {0}", mapRule.GetType().Name); } }
protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector) { var assembly = pluginConfiguration.InfrastructureAssembly; foreach (var validator in from tipo in assembly.GetExportedTypes() where tipo.BaseType != null && tipo.BaseType.IsGenericType && tipo.BaseType.GetGenericTypeDefinition() == typeof(ValidationRuleSet <>) select tipo.Assembly.CreateInstance(tipo.FullName)) { AddValidator(validator); pluginInspector.Log("Adding validator for {0}", validator.GetType().Name); } }
protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector) { var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, DefaultPath); Directory.CreateDirectory(path); var logFile = Path.ChangeExtension(pluginConfiguration.ModuleName, DefaultExtension); logFile = Path.Combine(path, logFile); _arquivo = new FileInfo(logFile); pluginInspector.Log("Logging to {0}", _arquivo.FullName); }
protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector) { var assembly = pluginConfiguration.InfrastructureAssembly; foreach (var mapRule in from tipo in assembly.GetExportedTypes() where tipo.BaseType == typeof(MapRule) select tipo.Assembly.CreateInstance(tipo.FullName)) { AddMapRule((MapRule)mapRule); pluginInspector.Log("Adding MapRule for {0}", mapRule.GetType().Name); } }
private void AutoRegister(Assembly interfacesAssembly, Assembly implementationsAssembly, bool useInterception, PluginInspector pluginInspector) { var implementationTypes = implementationsAssembly.GetExportedTypes(); var interfaceTypes = interfacesAssembly.GetExportedTypes(); foreach (var interfaceType in interfaceTypes) { if (!interfaceType.IsInterface) continue; var type = interfaceType; var concreteType = Array.Find(implementationTypes, t => type.IsAssignableFrom(t) && !type.Equals(t)); if (concreteType == null) continue; pluginInspector.Log("Interface {0} are mapped to {1}, {2} using interception", interfaceType.FullName, concreteType.FullName, useInterception ? string.Empty : "NOT"); _registeredTypes.Add(interfaceType, new TypeRegistry(concreteType, useInterception)); } }
protected override void ConfigurePlugin(PluginConfiguration pluginConfiguration, PluginInspector pluginInspector) { pluginInspector.Log("Mensagem {0}", "teste"); }