I've been digging around the demo store and noticed that you use code that doesn't exactly work on my machine so I'm wondering what I'm missing. I have a feeling it might be related to which modelbuilder is used?
Eg.:
On the home page you use: @Html.Action("FeaturedProducts", "ProductSurface") which returns the following error:
No route in the route table matches the supplied values.
You also seem to use the following on the search page where you use the namespace @using Vendr.DemoStore;
CS1061: 'PagedResult<IPublishedContent>' does not contain a definition for 'Cast' and no accessible extension method 'Cast' accepting a first argument of type 'PagedResult<IPublishedContent>' could be found (are you missing a using directive or an assembly reference?)
Since I don't use the Vendr.DemoStore I'm wondering if it's possible to see what's inside that namespace?
I don't think this is a ModelsBuilder issue, I just think you have missed copying some bits over.
The first code snippet is attempting to render a child action, but given the error, it would appear you haven't copied over our ProductSurfaceController which is responsible for rendering the featured products
Modelbuilder and namespace
Hi (Matt), ;)
I've been digging around the demo store and noticed that you use code that doesn't exactly work on my machine so I'm wondering what I'm missing. I have a feeling it might be related to which modelbuilder is used?
Eg.:
On the home page you use:
@Html.Action("FeaturedProducts", "ProductSurface")
which returns the following error:You also seem to use the following on the search page where you use the namespace
@using Vendr.DemoStore;
Which returns:
Since I don't use the Vendr.DemoStore I'm wondering if it's possible to see what's inside that namespace?
// Mike
Hi Mike, the demo store is open source on Github,
https://github.com/vendrhub/vendr-demo-store
HTH
t
Hi Mike,
I don't think this is a ModelsBuilder issue, I just think you have missed copying some bits over.
The first code snippet is attempting to render a child action, but given the error, it would appear you haven't copied over our ProductSurfaceController which is responsible for rendering the featured products
https://github.com/vendrhub/vendr-demo-store/blob/main/src/Vendr.DemoStore/Web/Controllers/ProductSurfaceController.cs#L25
Regarding the second issue, again, it looks like you've not copied over the Cast extension method which you can find here
https://github.com/vendrhub/vendr-demo-store/blob/main/src/Vendr.DemoStore/Extensions/PagedResultExtensions.cs#L8
Hope this helps
Matt
PS As Tom said, the whole of the demo store is open source so you can review all the code for it at https://github.com/vendrhub/vendr-demo-store
Hi Matt,
You are right, I don't have those files in the Vendr.DemoStore folder. If I download that entire folder, where should I place it?
I can see your DEMO project's .SLN file refers to the two folders:
Which mine doesn't. If I dowload the entire Vendr.DemoStore folder, how do I refer to it?
Hi Mike
When using ModelsBuilder you should be aware of these settings in
Web.config
: https://github.com/vendrhub/vendr-demo-store/blob/main/src/Vendr.DemoStore.Web/Web.config#L50-L54With these settings in demo store, ModelsBuilder generates the classes in this folder and use the namespace
Vendr.DemoStore.Models
: https://github.com/vendrhub/vendr-demo-store/tree/main/src/Vendr.DemoStore/ModelsWith this approach also ensure that new generated models are included in the project and compiled in the assembly, when building the project/solution.
/Bjarne
is working on a reply...