thanks again for your help ! is much appreciated. Got one more thing I wanted to put to you to do with the overall design of the system.
To try and explain what i was doing with the PromotedProduct table:
all my products are contained in the products table.
I also have the ability to display certain products on the homepage , and to order them in any order through the cms.
The items i want to promote and their order is determined through a table called PromotedProducts. I also need to be able to add any number of images to the products and to be able to add fields dynamically. I have done this throught two tables called ProductFields and ProductImages.
Here is a link to a screen shot of my database tables.
http://img392.imageshack.us/img392/2342/dbtablesma0.jpg
http://img392.imageshack.us/img392/d...jpg/1/w738.png
I am trying to trying to base my design on part 2 of the linqifying the beer house book.
I have been learning as I go along but one thing that strikes me is that it seems that what I am going to be creating in the BLL using these linq statements are going to be anonymous classes? It seems to make sense that the products data the BLL returns should combine the item fields and the images tables. I think I have found out how to return what I need for the products using something like the following
Code:
from product in context.ecom_products
select new {
product,
fields =
from productFields in context.ecom_productfields
where productFields.productId == product.productId select productField,
productImages =
from productImages in context.ecom_productImages
where productImages.productId == product.productId select productImages
}
I havent checked this code yet as is from an example i found, but think the general idea is there.
Is this a good way of doing things? The face that most of my data going to the UI is going to be in the form of anonymous classes worries me abit. Should I declare classes for this data? and would that mean I should go back into the linqtosql class and change the namespace back to DAL (the second part is now BLL as I am trying to follow the part2 of linquifying tbh).
Any guidance you can give me in how I should be structuring my design would be greatly appreciated , as it will soon be too late to change it.
Thanks for your quick replies.
Tom