我在ASP.NET MVC 5应用程序中使用AutoMapper 6.2.0.
当我通过控制器调用我的视图时,它显示所有正确的事情.但是,当我刷新该视图时,Visual Studio显示错误:
System.InvalidOperationException:'Mapper已初始化.您必须为每个应用程序域/进程调用一次Initialize.
我只在一个控制器中使用AutoMapper.尚未在任何地方进行任何配置,也未在任何其他服务或控制器中使用AutoMapper.
我的控制器:
public class StudentsController : Controller
{
private DataContext db = new DataContext();
// GET: Students
public ActionResult Index([Form] QueryOptions queryOptions)
{
var students = db.Students.Include(s => s.Father);
AutoMapper.Mapper.Initialize(cfg =>
{
cfg.CreateMap<Student, StudentViewModel>();
});
return View(new ResulList<StudentViewModel> {
QueryOptions = queryOptions,
Model = AutoMapper.Mapper.Map<List<Student>,List<StudentViewModel>>(students.ToList())
});
}
// Other Methods are deleted for ease...
Run Code Online (Sandbox Code Playgroud)
控制器内出错:
我的Model类:
public class Student
{
[Key]
public int Id { get; set; }
public string Name { get; …Run Code Online (Sandbox Code Playgroud) 我ng2-pdf-viewer在我的 Angular 8 应用程序中使用。
无论宽度如何,我都想显示适合容器高度的 PDF。因此,PDF 必须像我们可以通过Page Fit从 Mozilla 的 PDF 中的缩放选项(链接此处)中选择的那样获取所有高度:
我的代码ng2-pdf-viewer是:
<pdf-viewer
[src]='"./assets/images/userFiles/" + file.fileName'
[original-size]="false"
[render-text]='false'
[show-all]="false"
style="display: block; height: 100%;"
(after-load-complete)='afterLoadComplete($event)'
(page-rendered)='pageRendered($event)'
(pageChange)='pageChange($event)'
></pdf-viewer>
Run Code Online (Sandbox Code Playgroud)
几天来,我已经尝试了无数的方法来让它发挥作用。fit-to-page,给予height所有容器等等。
让我知道完成它的最佳方法是什么
我是 SequelizeJS 的新手,并将其用于带有 NodeJS 应用程序的 PostgreSQL。
我有一张桌子:
sequelize.define('log', {
id: {
type: type.INTEGER,
primaryKey: true,
autoIncrement: true
},
statusCode: type.INTEGER,
status: type.STRING,
message: type.TEXT,
lastRecordId: type.STRING,
lastRecordTime: type.DATE
});
Run Code Online (Sandbox Code Playgroud)
问题是,当我运行查询以按顺序从lastRecordId列中获取值DESC时,我得到的值顺序错误:
我不想在该列上使用INTEGER“nor” BIGINT,因为它包含一个代码,而不是一个实数。
我正在使用的查询是:
LoggerModel
.findAll({
order: [ [ 'lastRecordId', 'DESC' ]],
})
.then( allLogs => {
//...
})
Run Code Online (Sandbox Code Playgroud) 我是 Flutter 的新手,没有区别。通过提供颜色有什么区别
primaryColor 喜欢 theme: ThemeData(primaryColor: Colors.red)
和
colorScheme 喜欢 theme: ThemeData(colorScheme: ThemeData().colorScheme.copyWith(primary: Color.red))
因此,假如这个,如果我同时设置primaryColor并colorScheme.primary以不同的颜色,是什么改变UI,我们会得到。请检查以下示例:
Widget build(BuildContext context) {
final ColorScheme colorScheme = ColorScheme(
primary: Color(0xFFFFFFFF), // <---- I set white color here
primaryVariant: Color(0xFF117378),
secondary: Color(0xFFEFF3F3),
secondaryVariant: Color(0xFFFAFBFB),
background: Color(0xFF636363),
surface: Color(0xFF808080),
onBackground: Colors.white,
error: _lightFillColor,
onError: _lightFillColor,
onPrimary: _lightFillColor,
onSecondary: Color(0xFF322942),
onSurface: Color(0xFF241E30),
brightness: Brightness.light,
);
return Theme(
data: Theme(
primaryColor: Colors.red, // <----- I set color to red
colorScheme: colorScheme // <----- …Run Code Online (Sandbox Code Playgroud) angular ×1
angular8 ×1
asp.net ×1
asp.net-mvc ×1
automapper ×1
automapper-6 ×1
flutter ×1
pdf ×1
postgresql ×1
sequelize.js ×1