none
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.

    Regards,

    Kyle


    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 MSDNFSF@microsoft.com.

    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.

    https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/workflows/existing-database

    https://www.entityframeworktutorial.net/code-first/code-first-from-existing-database.aspx

    MVC is MVC.

    https://www.codeproject.com/Articles/228214/Understanding-Basics-of-UI-Design-Pattern-MVC-MVP

    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.

    https://www.c-sharpcorner.com/UploadFile/3d39b4/crud-using-the-repository-pattern-in-mvc/

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

    https://www.quora.com/How-is-the-MVC-pattern-used-in-windows-form-apps-C


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