Home > Net >  EF Core connection database (SQLite) doubt
EF Core connection database (SQLite) doubt

Time:11-11

Everybody is good, in learning how to use EF Core to recently to write data into the SQLite,
Which there would like to ask how to solve a problem, the problem is as follows...


I hope [] image variables in the database of type Blob, so will be defined as a Byte Array,
But the JSON format does not support binary data, so going to image file to receive through base64string,
Don't know how to modify, please board on advanced help again, thank you:)

-
The following is my account class

Public class Account
{
[Key, DatabaseGenerated (DatabaseGeneratedOption. Identity)]
Public string account {get; set; }
[Required]
Public string password {get; set; }
[Required]
Public string name {get; set; }
[Required]
Public byte [] image {get; set; }
[Required]
Public int privilege {get; set; }
[Required]
Public Int64 createTime {get; set; }
}

-

The following is the content of the restful API

[HttpPost]
Public IActionResult Post ([FromBody] Account entity)
{
The entity.
_dbContext. Account. Add (entity);
_dbContext. SaveChanges ();
Return the Get (entity. The account);
}
--

CodePudding user response:

Content of at least six words
  • Related