CodeFirst RRS feed

  • Question

  • I have these projects in my WindowsّForm Solution:
    Repository: IRepository class includes CURD Interface and The repositoryClass contains the implemented functions of the IRepository
    Model: Include Model Class.
    DbContext Include DbContext class
    Now I want to use the Update, Insert, Delete, Select functions of Repository in my Windows form  . what should I do?help me please.

    this is DbContext constructor 

    public X_Database_Context(DbContextOptions<X_Database_Context> options) : base(options)


    • Edited by Ali_Lonbar Wednesday, April 24, 2019 6:53 AM
    Wednesday, April 24, 2019 6:26 AM

All replies

  • Hi,

    I noticed that this is very similar to the content of a thread you created earlier, maybe you can refer to the answer in that thread: Data Layer.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, April 25, 2019 5:13 AM
  • I suggest that you use EF code first against an existing database and let it build the model and Dbcontext.

    MVC is MVC.

    The generic Repository pattern is being used by the ASP.NET MVC solution with EF so study how the Repository is being used by the MVC Controller.

    You then duplicate it using the  MVC UI design pattern for Windows form solution.

    • Edited by DA924x Saturday, May 4, 2019 11:44 AM
    Saturday, May 4, 2019 11:43 AM