public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
listParent.Add("Chocolate");
listParent.Add("Biscuit");
listParent.Add("Milk");
listParent.Add("Sugar");
在一个普通的应用程序中,可以通过多种方式从数据库中检索到相同的信息。如果所有这些方法都实现了缓存,那么在更新数据库中的条目时,需要使所有这些缓存条目失效。
在更新和选择之间进行一些配对很容易。让我们以第9类中的一个产品123为例,价格为12.50美元。如果按ID选择产品:
select [...] from [Shop].[Product] where [ProductId] = 123
使用键Product<Id:123>缓存它,在更新了由ID标识的产品的价格后,就不难使这个缓存条目失效:
update [Shop].[Product] set [Price] = 14.99 w
我有以下型号:产品,加载项,AddonTypes,ProductAddons。
架构如下:
Product
id
name
Addons
id
name
type_id
AddonTypes
id
name
ProductAddons
id
product_id
addon_id
price
问题:我如何加入这些表格,使产品变得如此简单。
ProductAddons::model()->with('addons')->findAll()?
Q1:现在我得到了相关的副词,但我搞不懂,怎么才能得到副词类型呢?Q2:如何从联接表中获取属性。比如ProductAddo