I followed the WingtipToys tutorial on the Microsoft website, which is basically a tutorial for ASP.NET and shows off numerous features it can do, and so on.
I made my own database to use during the tutorial, and had it working flawlessly on my local machine. Then, I decided to publish it to Azure to see it working online properly, which is where my issues began.
Firstly, I made a SQL database in Azure and moved my database across. I can connect to this Azure database in Visual Studio, and can verify that all the right tables are there, each filled with data;
The next step was to update my connection string, which is currently;
<connectionStrings>
<add name="WingtipTpys" providerName="System.Data.SqlClient" connectionString="Server=tcp:xxxx.database.windows.net,1433;Database=xxxx;Integrated Security=False;User Id=xxx;Password=xxxx;Encrypt=True;TrustServerCertificate=False;MultipleActiveResultSets=True" />
</connectionStrings>
Now, I was under the impression at this stage that the database and the website could now communicate with each other, so I published the website to see how it looks, which is where the really confusing part (for me) occurs.
When I visit the website URL that I published (http://completebusiness2017.azurewebsites.net/) it uses the right master page, and the about and contact pages are both how they should be. But, it is pulling in data from the;
ProductDatabaseInitializer
Class, which contains code such as;
private static List<Product> GetProducts()
{
var products = new List<Product> {
new Product
{
ProductID = 1,
ProductName = "TEST",
Description = "This convertible car is fast! The engine is powered by a neutrino based battery (not included)." +
"Power it up and let it go!",
ImagePath="",
UnitPrice = 39.50,
CategoryID = 1
},
new Product
{
ProductID = 2,
ProductName = "Silly Car",
Description = "There's nothing old about this toy car, except it's looks. Compatible with other old toy cars.",
ImagePath="",
UnitPrice = 15.95,
CategoryID = 1
},
This class has been there all along, but on my local machine, it was never used. The data came straight from the database I created. I don't understand how now I have updated the connection string, it is pulling data from this class, and not my database. Another strange element, is that when I update this class, so for example I changed;
Convertible Car Price from 22.50 to 39.50 and Old-time Car name to Silly Car
These do not update when the website is published again. So I have no idea where or why it is using the old data.
So I guess my first question is, when I update the ProductDatabaseInitializer class, why aren't these changes reflected when the website is published again? I think I should understand why that is happening before I query why my database isn't working properly.
Any help at all would be very much appreciated.
Thank you, happy holidays.

