Sample: TestMVC - etmendz/Mendz.Data.SqlServer GitHub Wiki
- In Visual Studio, create a new ASP.Net Core MVC web project called TestMVC.
- Add a reference to Mendz.Data.
- Add a reference to TestRepositories.
- Add a reference to TestModels.
- In appsettings.json, add the following entry:
"DataSettings": {
"ConnectionStrings": {
"SqlServerConnectionString": "Data Source=(LocalDB)\\MSSQLLocalDB;Initial Catalog=TestDB;Integrated Security=True;Pooling=False"
}
}
- 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>());
}
- Add the TestController.
- In the Views folder, add a sub-folder named Test. In the Views/Test folder:
- Setup TestDB.
- Build and run TestMVC (Debug). In the launched browser's address bar, append "/Test" (without quotes) to the URL and press enter.
Have fun!