protected override void RegisterComponents() { Mappers.Add("Flattening.Class.AutoMapper", new AutoMapperWrapper()); Mappers.Add("Flattening.Class.ObjectMapper", new ObjectMapperWrapper()); Mappers.Add("Flattening.Class.NLiteMapper", new NLiteMaperWrapper()); Mappers.Add("Flattening.Class.EmitMapper", new EmitMapperWrapper()); Mappers.Add("Flattening.Class.Manual", new ManualMapper()); }
public FluentEntityMapper(EntityMappingConfiguration <TEntity> configuration) { foreach (var mapping in configuration.Mappings) { Mappers.Add(mapping.DataElementId, new ElementPropertyMapper <TEntity>(mapping.DataElementId, mapping.Property)); } }
private void Init() { EnableSqlTrace = EnableSqlTraceDefault; NPocoDatabaseExtensions.ConfigureNPocoBulkExtensions(); if (SqlContext.DatabaseType == DatabaseType.SQLCe) { Mappers.Add(new SqlCeImageMapper()); } }
/// <summary> /// Maps the specified exception type <typeparamref name="TException"/> to a <see cref="ProblemDetails"/> instance /// using the specified <paramref name="mapping"/> function. /// </summary> /// <remarks> /// Mappers are called in the order they're registered. /// Returning <c>null</c> from the mapper will signify that you can't or don't want to map the exception to <see cref="ProblemDetails"/>. /// This will cause the exception to be rethrown. /// </remarks> /// <param name="predicate">This Map will skip this exception if the predicate returns false.</param> /// <param name="mapping">The mapping function for creating a problem details instance.</param> /// <typeparam name="TException">The exception type to map using the specified mapping function.</typeparam> public void Map <TException>( Func <HttpContext, TException, bool> predicate, Func <HttpContext, TException, MvcProblemDetails?> mapping) where TException : Exception { Mappers.Add(new ExceptionMapper( typeof(TException), (ctx, ex) => mapping(ctx, (TException)ex), (ctx, ex) => predicate(ctx, (TException)ex))); }
public IDataReaderObjectMapper GetMapper <T>(object key, IDataReader reader) { if (Mappers.Keys.Contains(key)) { return((IDataReaderObjectMapper)Mappers[key]); } var mapper = Bootstrapper.GetContainer().Resolve <IDataReaderObjectMapper>();; mapper.Initialize <T>(reader); Mappers.Add(key, mapper); return(mapper); }