Problem with not null foreign key
Posted: Wed 25 Nov 2009 21:37
Hi,
I have a table with a field foreign key in another table. This field could also be null. When I use this kind of object (with null foreign key field) LINQ to Oracle performs many useless query in order to retrieve the lookup record contents.
Ex.
In the table Products, the field ProductCategory is a foreign key in Categories table. In my Products table the ProductCategory field could also be null.
When I create object from Products table and I try to access to DCategories.Description the system queries for Categories even if the ProductCategory field is empty. It seems the system doesn't distinguish from null DCategories collection and not yet loaded DCategories collection. Every time I try to access to DCategories member (for the same object) the system perform a query for Categories.
dotConnect for Oracle 5.35.54
I have a table with a field foreign key in another table. This field could also be null. When I use this kind of object (with null foreign key field) LINQ to Oracle performs many useless query in order to retrieve the lookup record contents.
Ex.
In the table Products, the field ProductCategory is a foreign key in Categories table. In my Products table the ProductCategory field could also be null.
When I create object from Products table and I try to access to DCategories.Description the system queries for Categories even if the ProductCategory field is empty. It seems the system doesn't distinguish from null DCategories collection and not yet loaded DCategories collection. Every time I try to access to DCategories member (for the same object) the system perform a query for Categories.
dotConnect for Oracle 5.35.54