本文整理汇总了C#中IMapper类的典型用法代码示例。如果您正苦于以下问题:C# IMapper类的具体用法?C# IMapper怎么用?C# IMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMapper类属于命名空间,在下文中一共展示了IMapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Map
public override void Map(IMapper map)
{
map.DebugRoute("routedebug");
map.Root<CommentsController>(c => c.Index(null));
map.Resources<CommentsController>(c => c.Only("index", "new", "create"));
map.Resource<ContactController>(c => c.Only("new", "create"));
map.Resource<ErrorController>(e => e.Only("show"));
/*
* Note: You can register and next resources
*
map.Root<HomeController>(x => x.Index());
map.Resources<BlogsController>(blogs =>
{
blogs.As("weblogs");
blogs.Only("index", "show");
blogs.Collection(x => x.Get("latest"));
blogs.Resources<PostsController>(posts =>
{
posts.Except("create", "update", "destroy");
posts.Resources<CommentsController>(c => c.Except("destroy"));
});
});
map.Area<Controllers.Admin.BlogsController>("admin", admin =>
{
admin.Resources<Controllers.Admin.BlogsController>();
admin.Resources<Controllers.Admin.PostsController>();
});
*/
}
示例2: Map
public override void Map(IMapper map)
{
map.DebugRoute("routedebug");
map.Root<CategoryController>(c => c.Index("/"));
map.Resources<UserController>();
map.Resources<ReportController>(c => c.Member(x => x.Get("Search")));
map.Resources<ReportParameterController>(reportParameter => reportParameter.Only("Index"));
map.Resources<CategoryController>(category => category.Only("Index"));
map.Resources<ClientController>(client => client.Only("Index"));
map.Resources<RoleController>(r => r.WithFormatRoutes());
map.Resource<FileController>(file => file.Only("Create"));
map.Resource<SearchController>(s => s.Only("New", "Create"));
map.Resources<AccountController>(
account =>
{
account.Except("new", "create", "show", "index", "update", "destroy");
account.Collection(x => x.Get("Login"));
account.Collection(x => x.Post("Login"));
account.Collection(x => x.Get("Register"));
account.Collection(x => x.Post("Register"));
account.Collection(x => x.Put("Confirm"));
});
}
示例3: ProjectPartnersController
public ProjectPartnersController(
IRepository<Partner> partners,
IMapper mapper)
{
this.Partners = partners;
this.Mapper = mapper;
}
示例4: CourseController
public CourseController(ICourseRepository courseRepository, IDepartmentRepository departmentRepository,
IMapper mapper)
{
_courseRepository = courseRepository;
_departmentRepository = departmentRepository;
_mapper = mapper;
}
示例5: PersonController
public PersonController(IPersonRepository personRepository, IMapper mapper)
{
if (personRepository == null) throw new ArgumentNullException(nameof(personRepository));
if (mapper == null) throw new ArgumentNullException(nameof(mapper));
_personRepository = personRepository;
_mapper = mapper;
}
示例6: UserController
public UserController(
IIdentityService identityService,
IMapper<string, string, LoginPageViewModel> loginPageViewModelMapper)
{
this.identityService = identityService;
this.loginPageViewModelMapper = loginPageViewModelMapper;
}
示例7: ProjectScreenshotService
public ProjectScreenshotService(IProjectRepository projectRepository, IMapper mapper, IFileUriProvider uriProvider, IFileSystem fileSystem)
{
_projectRepository = projectRepository;
_uriProvider = uriProvider;
_fileSystem = fileSystem;
_mapper = mapper;
}
示例8: MessageRepository
public MessageRepository(IMapper<Message, MessageDocument> messageDocumentMapper)
{
this.messageDocumentMapper = messageDocumentMapper;
mappingSource = new AttributeMappingSource();
connectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
context = new AppContext(connectionString);
}
示例9: CreateMaps
public void CreateMaps(IMapper mapper)
{
mapper.CreateMap<ScheduledJobDto, ScheduledJobModel>().ForMember(
m => m.StartTime,
x => x.MapFrom(j => userService.ToCurrentUserTimeZone(HttpContext.Current.Wrap(), j.StartTime))
);
}
示例10: ThingyController
public ThingyController(IGetThingyQuery getThingyQuery, IMapper<ThingyQueryDto, ThingyModel> dtoToModelMapper,
ISaveThingyCommand saveThingyCommand)
{
GetThingyQuery = getThingyQuery;
DtoToModelMapper = dtoToModelMapper;
SaveThingyCommand = saveThingyCommand;
}
示例11: AffinityGroupItemCountsRepository
public AffinityGroupItemCountsRepository(ICassandraSession session, IMapper mapper)
{
_session = session;
_mapper = mapper;
// Preparing statements
TableAttribute tableAttribute = typeof (AffinityGroupItemCountsEntity).GetCustomAttributes(typeof (TableAttribute), true).Select(a => (TableAttribute)a).First();
string entityName = tableAttribute.Name;
string rowKeyPropertyName = NameOfHelper.PropertyName<AffinityGroupItemCountsEntity>(x => x.AffinityGroupSignalType);
string itemIdPropertyName = NameOfHelper.PropertyName<AffinityGroupItemCountsEntity>(x => x.ItemId);
string countPropertyName = NameOfHelper.PropertyName<AffinityGroupItemCountsEntity>(x => x.Count);
_getByIdStatement =
new Lazy<PreparedStatement>(() => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ? AND \"{2}\" = ?", entityName, rowKeyPropertyName, itemIdPropertyName)));
_getStatement =
new Lazy<PreparedStatement>(
() => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ?", entityName, rowKeyPropertyName)));
_incStatement =
new Lazy<PreparedStatement>(
() =>
_session.Get()
.Prepare(string.Format("UPDATE \"{0}\" SET \"{1}\" = \"{1}\" + 1 WHERE \"{2}\" = ? AND \"{3}\" = ?", entityName, countPropertyName, rowKeyPropertyName, itemIdPropertyName)));
_decStatement =
new Lazy<PreparedStatement>(
() =>
_session.Get()
.Prepare(string.Format("UPDATE \"{0}\" SET \"{1}\" = \"{1}\" - 1 WHERE \"{2}\" = ? AND \"{3}\" = ?", entityName, countPropertyName, rowKeyPropertyName, itemIdPropertyName)));
}
示例12: StudentController
public StudentController(IGenericRepository repository,
IMapper<Student, ProfileModel> studentToProfileModelMapper,
IMapper<Student, IndexModel> studentToStudentIndexModelMapper,
IMapper<NameModel, Student> studentNameToStudentMapper,
IMapper<HomeAddressModel, StudentAddress> studentHomeAddressToStudentMapper,
AzureStorageUploader fileUploader, IStudentRepository studentRepository,
IMapper<EditableStudentBiographicalInfoModel, Student> studentBiographicalInfoToStudentMapper,
IParentRepository parentRepository,
IMapper<EditProfileParentModel, Parent> editProfileParentModelToParentMapper,
ProgramStatusModelToProgramStatusForEditMapper programStatusModelToProgramStatusForEditMapper,
EditAcademicDetailModelToStudentAcademicDetailMapper editAcademicDetailModelToStudentAcademicDetailMapper)
{
_repository = repository;
_studentToProfileModelMapper = studentToProfileModelMapper;
_studentToStudentIndexModelMapper = studentToStudentIndexModelMapper;
_fileUploader = fileUploader;
_studentRepository = studentRepository;
_studentBiographicalInfoToStudentMapper = studentBiographicalInfoToStudentMapper;
_studentNameToStudentMapper = studentNameToStudentMapper;
_studentHomeAddressToStudentMapper = studentHomeAddressToStudentMapper;
_parentRepository = parentRepository;
_editProfileParentModelToParentMapper = editProfileParentModelToParentMapper;
_programStatusModelToProgramStatusForEditMapper = programStatusModelToProgramStatusForEditMapper;
_editAcademicDetailModelToStudentAcademicDetailMapper = editAcademicDetailModelToStudentAcademicDetailMapper;
}
示例13: JobsController
public JobsController(
IExchangePublisher<JobRequest> jobExchangePublisher,
IMapper<CreateJobFromFileRequest, JobRequest> jobRequestMapper)
{
this.jobRequestMapper = jobRequestMapper;
this.jobExchangePublisher = jobExchangePublisher;
}
示例14: AutoMapViewResult
public AutoMapViewResult(IMapper mapper, Type sourceType, Type destinationType, ViewResult view)
{
Mapper = mapper;
SourceType = sourceType;
DestinationType = destinationType;
View = view;
}
示例15: BasicApiProvider_1_4
public BasicApiProvider_1_4(IMapper mapper, IEventsProvider eventAggregator)
{
Helper.GuardNotNull(mapper);
Helper.GuardNotNull(eventAggregator);
_mapper = mapper;
_eventAggregator = eventAggregator;
}