public ContactService(AutoMapper.IMapper mapper, IDbConnection connection) { this.connection = connection; database = new Database(connection); this.mapper = mapper; }
public void Init(int randomDataSampleSize, int listMapperListSize = 1000) { RandomDataSampleSize = randomDataSampleSize; var config = new MapperConfiguration(cfg => { cfg.CreateMap <B, B>(); cfg.CreateMap <C, C>(); cfg.CreateMap <D, D>(); cfg.CreateMap <E, E>(); cfg.CreateMap <F, F>(); cfg.CreateMap <B, BDto>(); cfg.CreateMap <C, CDto>(); cfg.CreateMap <D, DDto>(); cfg.CreateMap <E, EDto>(); cfg.CreateMap <F, FDto>(); cfg.CreateMap <BDto, B>(); cfg.CreateMap <CDto, C>(); cfg.CreateMap <DDto, D>(); cfg.CreateMap <EDto, E>(); cfg.CreateMap <FDto, F>(); }); config.AssertConfigurationIsValid(); _mapper = config.CreateMapper(); AssignRandomData(randomDataSampleSize); }
public QualificationApiControllertest() { var serviceProvider = services.BuildServiceProvider(); tenderService = serviceProvider.GetService <ITenderAppService>(); qualificationAppService = serviceProvider.GetService <IQualificationAppService>(); iDMAppService = serviceProvider.GetService <IIDMAppService>(); lookupAppService = serviceProvider.GetService <ILookUpService>(); supplierqualificationService = serviceProvider.GetService <ISupplierQualificationDocumentAppService>(); verificationService = serviceProvider.GetService <IVerificationService>(); //Configure mapping just for this test var config = new MapperConfiguration(cfg => { cfg.CreateMap <PreQualificationBasicDetailsModel, PreQualificationBasicDetailsModel>(); cfg.CreateMap <MOF.Etimad.Monafasat.Core.Entities.Tender, PreQualificationSavingModel>(); cfg.ValidateInlineMaps = false; }); mapper = config.CreateMapper(); _mockRootConfiguration = MockHelper.CreateIOptionSnapshotMock(new MOF.Etimad.Monafasat.SharedKernal.RootConfigurations()); //verificationService = new Mock<IVerificationService>().Object; authorizationService = new Mock <IAuthorizationService>().Object; supplierService = new Mock <ISupplierService>().Object; offerAppService = new Mock <IOfferAppService>().Object; supplierQualificationDocumentDomainService = new Mock <ISupplierQualificationDocumentDomainService>().Object; memoryCache = new Mock <IMemoryCache>().Object; branchAppService = new Mock <IBranchAppService>().Object; _qualificationController = new QualificationController(supplierqualificationService, qualificationAppService, mapper, verificationService, iDMAppService, authorizationService, supplierService, offerAppService, lookupAppService, tenderService, supplierQualificationDocumentDomainService, _mockRootConfiguration); _lookupController = new LookupController(lookupAppService, mapper, iDMAppService, branchAppService, memoryCache, _mockRootConfiguration); }
public UserStreamDalCassandra(string keyspace = "SocialNetwork", string[] nodes = null, ConsistencyLevel consistencyLevel = ConsistencyLevel.One) { nodes = new string[] { "127.0.0.1" }; var conf = new MapperConfiguration(mc => { mc.AddProfile(new UserStreamProfile()); mc.AddProfile(new PostStreamProfile()); }); _StreamMapper = conf.CreateMapper(); _keyspace = keyspace; _cluster = Cluster.Builder() .AddContactPoints(nodes) .WithQueryOptions(new QueryOptions().SetConsistencyLevel(consistencyLevel)) .Build(); if (MappingConfiguration.Global.Get <StreamProfile>() == null) { MappingConfiguration.Global.Define <StreamProfile>(); } if (MappingConfiguration.Global.Get <UserProfile>() == null) { MappingConfiguration.Global.Define <UserProfile>(); } if (MappingConfiguration.Global.Get <UserStreamProfile>() == null) { MappingConfiguration.Global.Define <UserStreamProfile>(); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(); // Make sure you call this previous to AddMvc services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddDbContext <AddressbookContext>(opt => opt.UseInMemoryDatabase("TodoList")); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddScoped <IAddressbookContext, AddressbookContext>(); services.AddMvc(); //Automapper configuration files var config = new MapperConfiguration(cfg => { cfg.CreateMap <Models.Contact, DBModels.Contact>(); cfg.CreateMap <DBModels.Contact, Models.Contact>(); }); AutoMapper.IMapper mapper = config.CreateMapper(); services.AddSingleton(mapper); //Database configuration files string conString = Configuration.GetValue <string>("Data:ConnectionString"); Database db = new Database(conString, "System.Data.SqlClient"); services.AddSingleton(db); }
private static void MapEntities() { var config = MapBOEntities(); AutoMapper.IMapper mapper = config.CreateMapper(); AopEngine.Container.RegisterInstance(mapper); }
public ProductService(IUnitOfWork uunitOfWork, IMapper mapper, IMyMapper myMapper) { _unitOfWork = uunitOfWork; _mapper = mapper; _myMapper = myMapper; _productRepository = _unitOfWork.GetRepository <Product>(); _productCategoryRepository = _unitOfWork.GetRepository <ProductCategory>(); }
public Mapper() { configurations = new MapperConfiguration(cfg => { cfg.AddProfile <DefaultMapping>(); }); mapper = configurations.CreateMapper(); }
public PagesController( ILogger <PagesController> logger, IMapper mapper, IDocumentService <SharedContentItemModel> sharedContentItemDocumentService) { this.logger = logger; this.mapper = mapper; this.sharedContentItemDocumentService = sharedContentItemDocumentService; }
public void OneTimeSetup() { var mapperConfiguration = new MapperConfiguration(cfg => cfg.AddProfiles(new[] { new StudentProfile() })); mapperConfiguration.CompileMappings(); mapperConfiguration.AssertConfigurationIsValid(); mapper = mapperConfiguration.CreateMapper(); }
public static void RegisterAutoMappers() { Mapping = new MapperConfiguration(config => { config.CreateMap <Product, ProductViewModel>(); config.CreateMap <ProductCategory, ProductCategoryViewModel>(); config.CreateMap <Tag, TagViewModel>(); config.CreateMap <ProductTag, ProductTagViewModel>(); }).CreateMapper(); }
public ExchangeMailService(ProfileRegister register, ExchangeProfileDataStore.Factory storeFactory, MSGraph.GraphServiceClient client, AM.IMapper mapper) { _register = register; _storeFactory = storeFactory; _client = client; _mapper = mapper; }
public VooService(AutoMapper.IMapper mapper, IAeroportoRepository aeroportoRepository, IAeronaveRepository aeronaveRepository, IVooRepository repositorio, LNoty notificacoes) : base(repositorio, notificacoes) { _aeroportoRepository = aeroportoRepository; _aeronaveRepository = aeronaveRepository; _mapper = mapper; }
/// <summary> /// Method to map object from source into target /// </summary> /// <typeparam name="T">source generic type</typeparam> /// <typeparam name="K">target object generic type</typeparam> /// <param name="source">source object</param> /// <param name="target">target object</param> public void Map <T, K>(T source, K target) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <T, K>(); }); // CreateMap<T, K>(); AutoMapper.IMapper iMapper = config.CreateMapper(); //var source = new T(); var destination = iMapper.Map <T, K>(source); iMapper.Map(source, target); }
public FarmerSchedulerRepository(AutoMapper.IMapper mapper, ISchedulerFactory schedulerFactory) { _schedulerFactory = schedulerFactory ?? throw new ArgumentNullException(nameof(schedulerFactory)); _mapper = mapper; _Database = new Database(DatabaseConfigure.DBConnec, DatabaseConfigure.DBProvider, null); _verificationAddSchedulerData = new VerificationAddSchedulerData(); _verificationSelectSchedulerData = new VerificationSelectSchedulerData(); _verificationUpdateSchedulerData = new VerificationUpdateSchedulerData(); _jobDetailAndTrigger = new JobDetailAndTrigger(schedulerFactory); scheduler = _schedulerFactory.GetScheduler().Result; }
public LocationService( ILogger <LocationService> logger, AutoMapper.IMapper mapper, EventManagementDbContext context, ILocationRepository repository) { this.logger = logger; this.mapper = mapper; this.context = context; this.repository = repository; }
public static void MapperInit(Type src, Type dst) { mapperConfig = new AutoMapper.MapperConfiguration(cfg => { cfg.CreateMap(src, dst); cfg.AllowNullCollections = true; cfg.AllowNullDestinationValues = true; }); iMapper = mapperConfig.CreateMapper(); iMapper.ConfigurationProvider.CompileMappings(); }
public UserManagementServiceTest() { var dbContextOptionBuilder = new DbContextOptionsBuilder <UserManagementContext>().UseInMemoryDatabase(databaseName: "temp"); var userContext = new UserManagementContext(dbContextOptionBuilder.Options); var mappingConfiguration = new MapperConfiguration(mc => { mc.CreateMap <List <User>, List <UserViewModel> >(); mc.CreateMap <CreateUserViewModel, User>(); }); this.mapper = new AutoMapper.Mapper(mappingConfiguration); this.userManagementService = new UserManagementService(userContext, this.mapper); }
private IUnityContainer CreateAndConfigreContainer() { var mapperConfiguration = new AutoMapper.MapperConfiguration(cfg => cfg.CreateMap <SalesRecord, SalesRecordDTO>()); _autoMapper = mapperConfiguration.CreateMapper(); var container = new UnityContainer(); container.RegisterInstance(_autoMapper); container.RegisterType <ApplicationDbContext, ApplicationDbContext>(); container.RegisterType <ISalesRecordsDataService, SalesRecordsDataService>(); return(container); }
public BookService( AutoMapper.IMapper mapper, IRepositoryAsync <Book> repository, IDataTableImportMappingService mappingservice, NLog.ILogger logger ) : base(repository) { this.mapper = mapper; this.repository = repository; this.mappingservice = mappingservice; this.logger = logger; }
public AutoMapperMapper(IEnumerable <MappingProfile> profiles) { var configuration = new MapperConfiguration( x => { foreach (var profile in profiles) { x.AddProfile(profile); } } ); mapper = configuration.CreateMapper(); }
public void Init(int randomDataSampleSize, int listMapperListSize = 1000) { RandomDataSampleSize = randomDataSampleSize; var config = new MapperConfiguration(cfg => { cfg.CreateMap <DeepBCDEF, DeepCDE>(); cfg.CreateMap <DeepCDE, DeepBCDEF>(); }); config.AssertConfigurationIsValid(); _mapper = config.CreateMapper(); AssignRandomDataLists(randomDataSampleSize, listMapperListSize); }
static async Task <MailFolder> RequestSpecialFolder(MSGraph.IMailFolderRequestBuilder requestBuilder, FolderType type, bool isFavorite, AM.IMapper mapper) { var folder = await requestBuilder.Request() .GetAsync() .ConfigureAwait(false); return(mapper.Map <MSGraph.MailFolder, MailFolder>(folder, opt => opt.AfterMap((src, dst) => { dst.IsFavorite = isFavorite; dst.Type = type; }))); }
public static List <TDest> MapList <TSource, TDest>(this AutoMapper.IMapper Mapper, IEnumerable <TSource> Source) where TDest : new() { var ret = new List <TDest>(); if (Source != null) { foreach (var item in Source) { var NewItem = Mapper.Map <TSource, TDest>(item); ret.Add(NewItem); } } return(ret); }
public void GlobalSetup() { _source = new X[N]; _dest = new Y[N]; MappingConfiguration.Add <ExplicitMapperConfiguration>(); MappingConfiguration.Build(); _explicitMapper = new MapperInstance(); var automapperConfig = new MapperConfiguration(c => c.AddProfile(new AutoMapperProfile())); automapperConfig.AssertConfigurationIsValid(); _autoMapper = automapperConfig.CreateMapper(); }
public CommonMapper() { var config = new MapperConfiguration(cfg => { cfg.CreateMap <User, UserProxy>(); cfg.CreateMap <UserProxy, User>(); cfg.CreateMap <Post, PostModel>(); cfg.CreateMap <PostModel, Post>(); cfg.CreateMap <Character, CharacterModel>(); cfg.CreateMap <CharacterModel, Character>(); cfg.CreateMap <CommentModel, Comment>(); cfg.CreateMap <Comment, CommentModel>(); }); mapper = config.CreateMapper(); }
public CmsApiService( CmsApiClientOptions cmsApiClientOptions, IApiDataProcessorService apiDataProcessorService, HttpClient httpClient, IMapper mapper, IApiCacheService apiCacheService, IContentTypeMappingService contentTypeMappingService) { this.cmsApiClientOptions = cmsApiClientOptions; this.apiDataProcessorService = apiDataProcessorService; this.httpClient = httpClient; this.mapper = mapper; this.apiCacheService = apiCacheService; this.contentTypeMappingService = contentTypeMappingService; }
private void Register(ILifetimeScope serviceProvier) { var mapperConfiguration = new MapperConfiguration.MapperConfigurationExpression(); IEnumerable <IEntityMapperConfig> configurators = AssemblyFinder.FindAllInterfaces <IEntityMapperConfig>(); foreach (IEntityMapperConfig mapperConfigurationInstance in configurators) { mapperConfigurationInstance.Config(mapperConfiguration, serviceProvier); } Mapper.Initialize(mapperConfiguration); IMapper createdMapper = Mapper.Configuration.CreateMapper(); _mapper = createdMapper; }
// IConfiguration iconfiguration; public AddressbookContext(DbContextOptions <AddressbookContext> options, IConfiguration iconfig, AutoMapper.IMapper mapper, Database db) : base(options) { // this.db = new Database("Data Source=INTDEV-PC;Initial Catalog=LearningDb-Sailesh;User ID=Intern;Password=P@ssw0rd", "System.Data.SqlClient"); string conString = iconfig.GetValue <string>("Data:ConnectionString"); // this.db = new Database(conString, "System.Data.SqlClient"); this.db = db; //var config = new MapperConfiguration(cfg => //{ // cfg.CreateMap<Models.Contact, DBModels.Contact>(); // cfg.CreateMap<DBModels.Contact, Models.Contact>(); //}); this.mapper = mapper; }
public ObjMapper(ISqlProcServ sqlProcServ, ICarriageServ carrServ, IReservSeatServ seatServ, IStationOnRouteServ statOnRouteServ, IPersonServ personServ, ITicketServ ticketServ) { this.seatServ = seatServ; this.sqlProcService = sqlProcServ; this.carrServ = carrServ; this.statOnRouteServ = statOnRouteServ; this.personServ = personServ; this.ticketServ = ticketServ; config = new MapperConfiguration(cfg => { cfg.CreateMap <TrainByTwoStationsAndDate, TrainByStationsAndDate>(); cfg.CreateMap <CarriageTypeInTrain, CarrTypesAndCountOfSeats>(); cfg.CreateMap <FreeSeatInCarr, FreeSeatInCarriage>(); cfg.AllowNullCollections = true; }); mapper = config.CreateMapper(); }