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

ObjectConstructed is not getting fired

5 Answers 29 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dilshod
Top achievements
Rank 1
Dilshod asked on 02 Jun 2016, 09:32 AM

Hi,

I am trying to load some entities from the database and in some cases ObjectConstructed is not getting fired. Here is what I have tried:

I have Table Person and Stuff. Stuff references to Person (one to many. )

<p>TelerikContext context = new TelerikContext();<br></p><p>context.Events.ObjectConstructed += (s, e) =>{ //my logic };</p><p>//Use case 1:</p><p>var people = context.People.ToList(); //in this case ObjectConstructed gets fired [people.Count] amount of times</p><p></p><p>//Use case 2:</p><p>var people = context.Stuff.Select(s=>s.Person).ToList(); // in this case I might have 5 person on my collection, but ObjectConstructed never gets fired. </p>

I want ObjectConstructed to be fired every time i load an object from DB so that I can do my logic accordingly. Can you please instruct me how to acheive that?

 

Thank you!

5 Answers, 1 is accepted

Sort by
0
Dilshod
Top achievements
Rank 1
answered on 02 Jun 2016, 09:36 AM

I couldn't edit my questions. Here I am reposting the use case.

 

TelerikContext context = new TelerikContext();

context.Events.ObjectConstructed += (s, e) =>{ //my logic };

//Use case 1:

var people = context.People.ToList(); //in this case ObjectConstructed gets fired [people.Count] amount of times

//Use case 2:

var people = context.Stuff.Select(s=>s.Person).ToList(); // in this case I might have 5 person on my collection, but ObjectConstructed never gets fired

0
Dilshod
Top achievements
Rank 1
answered on 14 Jun 2016, 10:25 AM

Hi,

Is there any progress on the issue above? I am waiting for the response. I need to take actions according to the answer.

 

Thanks,

Dilshod

0
Boris Georgiev
Telerik team
answered on 17 Jun 2016, 07:24 AM
Hello Dilshod,

Such an issue was never reported and I was not able to reproduce the issue. I prepared a sample application to demonstrate that it is working correctly. You could find the sample attached.

I hope that helps.

Regards,
Boris Georgiev
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Dilshod
Top achievements
Rank 1
answered on 08 Jul 2016, 05:57 AM

Hello Boris,

Finally I was able to reproduce the issue. To be able to reproduce the issue, please replace the: [xxxxx].IsIdentity(KeyGenerator.Autoinc) with [xxxxx].IsIdentity(). If you do that, object constructed doesn't get fired when you load the entity through select.

 

Thanks,

Dilshod

0
Boris Georgiev
Telerik team
answered on 13 Jul 2016, 12:30 PM
Hello Dilshod,

Thank you for the guidance how to reproduce the issue. After a long research we found out that this is a bug in Telerik DataAccess. Unfortunately I can not give you a time frame if we will fix the issue, when you can expect it.

Find your Telerik Points updated for the new bug you have helped us identify.
 
Regards,
Boris Georgiev
Telerik by Progress
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Tags
Development (API, general questions)
Asked by
Dilshod
Top achievements
Rank 1
Answers by
Dilshod
Top achievements
Rank 1
Boris Georgiev
Telerik team
Share this question
or