private void injectValidationAndFieldLengths(Configuration nhConfig) { if (string.IsNullOrWhiteSpace(ValidationDefinitionsNamespace)) { return; } MappingsValidatorEngine = new ValidatorEngine(); var configuration = new FluentConfiguration(); var validationDefinitions = MappingsAssembly.GetTypes() .Where(t => t.Namespace == ValidationDefinitionsNamespace) .ValidationDefinitions(); configuration .Register(validationDefinitions) .SetDefaultValidatorMode(ValidatorMode.OverrideExternalWithAttribute) .IntegrateWithNHibernate .ApplyingDDLConstraints() .And .RegisteringListeners(); MappingsValidatorEngine.Configure(configuration); //Registering of Listeners and DDL-applying here nhConfig.Initialize(MappingsValidatorEngine); }
private void AddMappings() { foreach (var file in Mappings) { configuration.AddResource(MappingsAssembly.GetName().Name + "." + file, MappingsAssembly); } }
private HbmMapping getMappings() { //Using the built-in auto-mapper var mapper = new ConventionModelMapper(); var allEntities = MappingsAssembly.GetTypes().Where(t => t.Namespace == MappingsNamespace).ToList(); mapper.AddAllManyToManyRelations(allEntities); mapper.ApplyNamingConventions(); if (AutoMappingOverride != null) { AutoMappingOverride(mapper); } var mapping = mapper.CompileMappingFor(allEntities); showOutputXmlMappings(mapping); return(mapping); }
private HbmMapping getMappings() { //Using the built-in auto-mapper var mapper = new ConventionModelMapper(); var allEntities = MappingsAssembly.GetTypes().Where(FilterAssembly).ToList(); foreach (var convention in this.Conventions) { convention.ProcessMapper(mapper); } if (AutoMappingOverride != null) { AutoMappingOverride(mapper); } var mapping = mapper.CompileMappingFor(allEntities); showOutputXmlMappings(mapping); return(mapping); }