private IMapper GetMapper() { var profile = new CategoryProfile(); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(profile)); return(new Mapper(configuration)); }
public static void Run() { var addressmapper = new AddressProfile(); var categorymapper = new CategoryProfile(); var customermapper = new CustomerProfile(); var customerRolemapper = new CustomerRoleProfile(); var manufacturermapper = new ManufacturerProfile(); var picturemapper = new PictureProfile(); var productAttributemapper = new ProductAttributeProfile(); var productmapper = new ProductProfile(); var specificationAttributemapper = new SpecificationAttributeProfile(); var tierPricemapper = new TierPriceProfile(); var config = new MapperConfiguration(cfg => { cfg.AddProfile(addressmapper.GetType()); cfg.AddProfile(categorymapper.GetType()); cfg.AddProfile(customermapper.GetType()); cfg.AddProfile(customerRolemapper.GetType()); cfg.AddProfile(manufacturermapper.GetType()); cfg.AddProfile(picturemapper.GetType()); cfg.AddProfile(productAttributemapper.GetType()); cfg.AddProfile(productmapper.GetType()); cfg.AddProfile(specificationAttributemapper.GetType()); cfg.AddProfile(tierPricemapper.GetType()); }); AutoMapperConfiguration.Init(config); }
public static void insertCategoryProfile(CategoryProfile cProfile) { using (var entity = new EntityFramework.CheckinDatasetEntities4()) { entity.CategoryProfile.Add(cProfile); entity.SaveChanges(); } }