Hi, I was looking SQL Server Profiler's trace output, and I noticed that,when I add (update) a child object, I see INSERT (UPDATE) sp call (of course!),
but I see also UPDATE sp call of root object (not dirty!).
I took an old Rolodex solution as guideline while developing my app; I'll have a deeper look at latest version of RolodexUsingPrism solution, in order to understand if it's my code, o something else..
Did anyone noticed same behavoiur ?
Thank you very much.
ps: sorry for my poor english.hope it's clear enough.
I understood where the bug was.
Tomorrow I'll tell more about it. ;)
Well, here I am.
II coded my classes (root & child) following Rolodex-EF samples.
In RolodexUsingPrism solution, \Rolodex.Server\BusinessClasses\Company.cs, method DataPortal_Update, newCompany is created ... and CompanyName setted with CSLA's company property (newCompany.CompanyName = ReadProperty(CompanyNameProperty);).
In my root object, I query EF in order to get newCompany instead of create a new one, then set all properties with CSLA object properties.
This last step, caused EF invoke UPDATE sp.
I didn't change EF company get instance (via query), and encapsulated properties setting in "if (CSLA_object.IsSelfDirty) { // ... set all properties... }".
This prevent EF UPDATE sp call.
That's all. :)
ps: I haven't test it yet on RolodexUsingPrism solution.
Do you have Julie Lerman's Programming Entity Framework book? I find this to be an invaluable resource for figuring out EF issues. Julie has really specialized in EF, and probably knows more about it than anyone outside the EF product team at Microsoft.
I'll get it asap.
Thank you very much.
Copyright (c) Marimer LLC