Reading single BLOB entry from stored procedure

前端 未结 1 344
甜味超标
甜味超标 2021-01-25 20:47

I need to complete my task using only stored procedures.

In my app I have Models called \'Document\' and \'DocumentInfo\' which refers to mysql tables. For example I go

1条回答
  •  执笔经年
    2021-01-25 21:25

    For FromSql, it is used with Query, you could define a new model for return result.

        public class ResultDto
    {
        public string Name { get; set; }
    }
    

    Define Query in OnModelCreating

            protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);
    
            builder.Query();
        }
    

    Useage:

      var result = _context.Query().FromSql("exec GetDocumentBodyById {0}", 1).ToList();
    

    0 讨论(0)
提交回复
热议问题