我在互联网上找到的所有数据都是关于CakePHP V2的.在V3中,我无法使用cakePHP 3配置MongoDB.我不知道如何为mongoDB配置数据源.我的默认数据库配置如下:
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'users',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
]
]
Run Code Online (Sandbox Code Playgroud) 有人可以用外行的术语解释ADO.NET和Entity Framework之间的区别吗?
我已经从Google搜索过,但无法理解两者之间的区别。
ADO.Net意味着使用sqlConnection();,sqlCommand();等来使用查询的数据库进行交互?
实体框架是指使用db.Add();,db.SaveChanges();函数与数据库交互而不使用查询吗?我对吗?
我想将文件与 JSON 一起发送
{
"comment" : "string",
"outletId" : 1
}
Run Code Online (Sandbox Code Playgroud)
我从文档中得到的帮助是
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
orderId:
type: integer
userId:
type: integer
fileName:
type: string
format: binary
Run Code Online (Sandbox Code Playgroud)
我不知道把这个架构放在哪里。我曾尝试将其放入@ApiProperty()DTO 以及 中,@ApiOperations但无法解决问题。
下面是我想在其中捕获文件内容的函数。
@Post('/punchin')
@ApiConsumes('multipart/form-data')
@ApiOperation({ summary: 'Attendance Punch In' })
@UseInterceptors(CrudRequestInterceptor, ClassSerializerInterceptor, FileInterceptor('file'))
@ApiImplicitFile({ name: 'file' })
async punchInAttendance( @Body() body: PunchInDto, @UploadedFile() file: Express.Multer.File ): Promise<Attendance> {
const imageUrl = await this.s3FileUploadService.upload(file)
console.log(body, imageUrl)
return await this.service.punchInAttendance({
comment: body.punchInComment,
outletId: body.outletId,
imgUrl: imageUrl, …Run Code Online (Sandbox Code Playgroud)