Hi,
Problem 1:
the NH docu has the statement:
Quote:
"no collections of collections may be mapped."
But there are some cases of "collections of collections", for which a mapping would be helpful and possible.
Example: class City has the property:
Code:
IDictionary<IGoodsType, ISet<IShop> > shopsByGoods
which could be used like:
Code:
Set<IShop> void findShop(IGoodsType goodsTyp) {
return shopsByGoods[goodsTyp];
}
The table has the schema:
Code:
table Tab_Shop
-----------------------
id | int - primary key
ref_id_city | int
ref_id_goods | int
name | string
opening_hours | string
address | string
rating | int
How can the property "shops" be mapped to table Tab_Shop?
+++++++++++++++++++++++++++++
Problem 2:Class City should have another (but read-only) property
Code:
ISet<IShop> allShops {
get { return shopsByGoods.Values; }
}
which returns all shops the city (i.e. for any goods type).
Problem 3: (deferred)Later on, the goods types could be arranged in a tree, with the (most general) goods-type "all" as root.
But that is to complicated and not required for the moment.
Thank you for your interest,
Mick
P.S.
I know that the used data base schema (table Tab_Shop) restricts the usage of the IDictionary: every shop may be assigned to almost one goods type.
So the realized concept is that of a "partitioning" of the set of shops.
But when using the IDictionary for read-only purposes there is no restriction.
In .NET Framework I found a class/interface like an IDictionary where you can add elements with an identifier property.
The elements of this special-dictionary can then asked by giving the id-value as the key-value, like in:
Code:
shopsByGoods[goodsTyp]
Problem: I don't remember the name of the class and can't find it again in the .NET docu.