This question is locked. New answers and comments are not allowed.
I have the following Class:
This is some test code to fetch objects of this Class:
(Adding "AddressShort" to the Fetchplan, doesn't make any differrence.)
OpenAccess generated the following SQL-Statements:
But I expected OpenAccess to use the AddressShort FetchPlan for references, so the SQL-Statement should look something more like this:
This might not be a problem with this little Testclass, but our Businesslayer contains Classes / Tables with more than 200 Fields and 10 circular References.
Is there any error in my definition of the FetchPlans, or have I misunderstood the concept of Fetchplans? What is the best way to meet my requirements?
Thanks,
Bianco Veigel
[Telerik.OpenAccess.Persistent(IdentityField =
"id"
)]
public
partial
class
Address
{
[Telerik.OpenAccess.FetchField(
"AddressShort"
)]
private
int
id;
// pk
[Telerik.OpenAccess.FetchField(
"AddressShort"
)]
private
string
city;
[Telerik.OpenAccess.FetchField(
"AddressFull"
)]
private
string
street;
[Telerik.OpenAccess.FetchField(
"AddressFull"
)]
private
string
zip;
[Telerik.OpenAccess.FetchField(
"AddressFull"
, Next =
"AddressShort"
)]
private
Address alternativeAddress;
}
This is some test code to fetch objects of this Class:
using
(var scope = _database.GetObjectScope())
{
scope.FetchPlan.Set(
new
[] {
"AddressFull"
});
var addresses = scope.Extent<Address>().ToList();
Assert.IsNotEmpty(addresses);
}
(Adding "AddressShort" to the Fetchplan, doesn't make any differrence.)
OpenAccess generated the following SQL-Statements:
SELECT
a.[Id] COL1,
a.[AlternativeAddress] COL2,
a.[City] COL3,
a.[Street] COL4,
a.[Zip] COL5,
b.[Id] COL6,
b.[AlternativeAddress] COL7,
b.[City] COL8,
b.[Street] COL9,
b.[Zip] COL10
FROM
[Address] a
LEFT
JOIN
[Address]
AS
b
ON
(a.[AlternativeAddress] = b.[Id])
But I expected OpenAccess to use the AddressShort FetchPlan for references, so the SQL-Statement should look something more like this:
SELECT
a.[Id] COL1,
a.[AlternativeAddress] COL2,
a.[City] COL3,
a.[Street] COL4,
a.[Zip] COL5,
b.[Id] COL6,
b.[City] COL7,
FROM
[Address] a
LEFT
JOIN
[Address]
AS
b
ON
(a.[AlternativeAddress] = b.[Id])
This might not be a problem with this little Testclass, but our Businesslayer contains Classes / Tables with more than 200 Fields and 10 circular References.
Is there any error in my definition of the FetchPlans, or have I misunderstood the concept of Fetchplans? What is the best way to meet my requirements?
Thanks,
Bianco Veigel