Sample: TestMVC - etmendz/Mendz.Data.SqlServer GitHub Wiki

  1. In Visual Studio, create a new ASP.Net Core MVC web project called TestMVC.
  2. Add a reference to Mendz.Data.
  3. Add a reference to TestRepositories.
  4. Add a reference to TestModels.
  5. In appsettings.json, add the following entry:
  "DataSettings": {
    "ConnectionStrings": {
      "SqlServerConnectionString": "Data Source=(LocalDB)\\MSSQLLocalDB;Initial Catalog=TestDB;Integrated Security=True;Pooling=False"
    }
  }
  1. In Startup.cs, add "using Mendz.Data;" and update Startup() constructor as follows:
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
            DataSettingOptions.Initialize(Configuration.GetSection("DataSettings").Get<DataSettings>());
        }
  1. Add the TestController.
  2. In the Views folder, add a sub-folder named Test. In the Views/Test folder:
  1. Setup TestDB.
  2. Build and run TestMVC (Debug). In the launched browser's address bar, append "/Test" (without quotes) to the URL and press enter.

Have fun!