Pro ASP.Net MVC 3 Entity Framework Sports Store tutorial

Following the guidance in the book "Pro ASP.Net MVC 3 Entity Framework" in Chapter 9 - Section "Downloading Images"; asks the Product class to be updated with two new columns - public byte ImageData and the public ImageType row. He also indicates that the database should be updated by these two columns through the server explorer.

After these updates, the discussion indicates that the Entity Framework conceptual model is updated through the SportsStore.EDMX file. This file does not exist in the source code for the project and was not used in the project to start. Obvious mistakes for the book.

Adding the ADO.NET Entity Data data model to the project then overrides the EFProduct repository (the conceptual model used throughout the project), which inherits the IProductsRepository interface; and leads to errors within the display.

If the project is debugged after adding columns, an error occurs with the newly added columns.

Has anyone solved this problem in a project? So far I have not found solutions.

+4
source share
2 answers

Found that the Product Image ImageData property is not in the brackets of the array []. It should read: public byte [] Imagedata {get; set; }

This handles runtime errors associated with using a null value for the data type of the ImageData data byte when working on an exercise book.

Thanks for the help!

+2
source

Add ImageData and ImageMimeType to the Products table, and then set all the values ​​as an empty row. it should make the sample application work.

0
source

Source: https://habr.com/ru/post/1383211/


All Articles