public EntityUpdateHandler(DecodedDto dtoInfo, DecodedEntityClass entityInfo, IWrappedAutoMapperConfig wrapperMapperConfigs, DbContext context) { _dtoInfo = dtoInfo ?? throw new ArgumentNullException(nameof(dtoInfo)); _entityInfo = entityInfo ?? throw new ArgumentNullException(nameof(entityInfo)); _wrapperMapperConfigs = wrapperMapperConfigs ?? throw new ArgumentNullException(nameof(wrapperMapperConfigs)); _context = context ?? throw new ArgumentNullException(nameof(context)); }
/// <summary> /// CrudServices needs the correct DbContext and the AutoMapper config /// </summary> /// <param name="context"></param> /// <param name="wapper"></param> public CrudServices(DbContext context, IWrappedAutoMapperConfig wapper) : base(context, wapper) { if (context == null) { throw new ArgumentNullException("The DbContext class is null. Either you haven't registered GenericServices, " + "or you are using the multi-DbContext version, in which case you need to use the CrudServices<TContext> and specify which DbContext to use."); } }
public CreateMapper(DbContext context, IWrappedAutoMapperConfig wrapperMapperConfigs, Type tDto, DecodedEntityClass entityInfo) { var myGeneric = typeof(GenericMapper <,>); var genericType = myGeneric.MakeGenericType(tDto, entityInfo.EntityType); var constructor = genericType.GetConstructors().Single(); Accessor = GetNewGenericMapper(genericType, constructor).Invoke(context, wrapperMapperConfigs, entityInfo); //Using Activator.CreateInstance with dynamic takes twice as long as LINQ new - see TestNewCreateMapper //Accessor = Activator.CreateInstance(genericType, context, wrapperMapperConfigs, entityInfo); }
public GenericMapper(DbContext context, IWrappedAutoMapperConfig wrappedMapper, DecodedEntityClass entityInfo) { _context = context ?? throw new ArgumentNullException(nameof(context)); _wrappedMapper = wrappedMapper ?? throw new ArgumentNullException(nameof(wrappedMapper)); _entityInfo = entityInfo ?? throw new ArgumentNullException(nameof(entityInfo)); }
internal GenericServicesSetupPart2(IServiceCollection services, IGenericServicesConfig publicConfig, IWrappedAutoMapperConfig autoMapperConfig) { Services = services ?? throw new ArgumentNullException(nameof(services)); PublicConfig = publicConfig ?? throw new ArgumentNullException(nameof(publicConfig)); AutoMapperConfig = autoMapperConfig ?? throw new ArgumentNullException(nameof(autoMapperConfig)); }