This is a migrated thread and some comments may be shown as answers.

Materialize Join Query, Persistent Type

3 Answers 45 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Seabus
Top achievements
Rank 1
Seabus asked on 23 Jul 2011, 12:01 AM
Hi,

Let's say I have a persisent type called "school" ...

"school" has just ID, Name, Address .

I have a SQL Query that returns

RowIndex, School.ID, School.Name, School. Address

how can I materialize to a projection class ?
class School2
{
 int RowIndex;
 School school ;
}

????

Seabus

3 Answers, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 26 Jul 2011, 03:02 PM
Hello Seabus,

 There are several requirements for materializing custom shapes using our new ADO API. 
1. The column names should map 1:1 to your property names (name wise)
2. Your properties need to be public.
3. Your properties need to have a setter.
If all those requirements are met you should not have any problems to materialize custom shapes using our ADO API. A detailed step by step example is present in our documentation should you need it.

Greetings,
Petar
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Seabus
Top achievements
Rank 1
answered on 29 Jul 2011, 05:13 PM
Hi,

I do understand that ... However, what I'm trying to do is a bit different

The help file has a section on how to materialize a type that IS defined in the domain model and a section on how to materialize a type that IS NOT defined in my domain model .

What I'm trying to achieve is a special case ...a combination of both cases ... I want to  materialize a type that is NOT DEFINED in my domain model however the class contains a property of a type that IS defined in the domain model.


public class SpecialStudent    /// NOT DEFINED in the DOMAIN model
{
  public int Index {get;set; }
  public Student { get;set; }        // DEFINED in the DOMAIN model
}

the query is a query that uses the ROW_NUMBER function of MS SQL .....
SELECT ROW_NUMBER() OVER(ORDER BY SalesYTD DESC) AS 'Index' , *
FROM StudentsTable



Seabus

0
PetarP
Telerik team
answered on 03 Aug 2011, 03:35 PM
Hello Seabus,

 What you are trying to do is currently not supported. Materialization of relational graphs is not included in our version one of the ADO.API.
There should be a simple workaround for you however. You can have a property StudentID that will be materialized by our ADO.API and a property Student (of type Student) that will represent your object relationship. When accessing the property Student you should write some custom logic to materialize a student based on the ID you have in your student id.
I hope that helps.

Regards,
Petar
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
General Discussions
Asked by
Seabus
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Seabus
Top achievements
Rank 1
Share this question
or