Base solution for your next web application
Open Closed

How to create User Defined Function using Code First in ABP? #4506


User avatar
0
manojreddy created

I want to create some user-defined functions using code first approach in abp framework.

I have created stored procedures xyz by adding xyz.sql inside EntityFrameworkCore\Migrations\Stored Procedures folder, But not able to find a way to create a function, please help.


7 Answer(s)
  • User Avatar
    0
    yekalkan created

    Hi,

    We have a CodeProject article about that.

    <a class="postlink" href="https://www.codeproject.com/Articles/1199648/Using-Stored-Procedure-User-Defined-Function-and-V">https://www.codeproject.com/Articles/11 ... tion-and-V</a>

  • User Avatar
    0
    manojreddy created

    Hi yekalkan,

    this article is about how to call SP and user-defined functions from C# code. But my question is different. I want to create user defined function using code first approach.

    I'm able to create stored procedures using code first approach but not able to create UDF.

    So basically I want to create UDF and add it to a migration. like we do for tables and stored procedures.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ManojReddy,

    This is directly related to EF I think. You can check it on the web or ask it on EF github repository.

  • User Avatar
    0
    manojreddy created

    Hi @ismcagdas,

    Thanks for your suggestion, I have posted my query in EF github repo, It would be a great help if in meanwhile your team can provide the solution or any hint.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ManojReddy,

    I'm not sure if this works but you can give it a try.

    Run Add-Migration command to create an empty migration. Then you can execute sql command in this migration to create a UDF.

  • User Avatar
    0
    manojreddy created

    I have posted my answer here, please check it might help somebody.

    [https://stackoverflow.com/a/48268866/6527049])

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @ManojReddy :)