It would be a great feature for OpenAccess to implement automatically the PropertyChanging and PropertyChanged events in the generated entities without any changes or maintenance to the T4 template.
Those two events are common implementations nowadays... (You even wrote an How-To article about those events)
For more flexibility, a boolean property in the Domain Class could let us choose if we want the PropertyChanging and PropertyChanged to be implemented.
Best Regards,
5 Answers, 1 is accepted
Thank you for the idea. It has been logged and we will discuss adding such functionality in one of our future releases.
Ivailo
the Telerik team
Q3’11 of Telerik OpenAccess ORM is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!
One more argument in favor of a built-in generation of PropertyChanging and PropertyChanged events.
I just updated OpenAccess to it's latest version and I did find out that:
1) The new version of Open Access overwrited the change I've made in the .ttinclude files
2) When I went back to the How-To article to fix what has been overwrited, the code provided in the article doesn't match the new .ttinclude file so if someone doesn't pay attention or don't understant what is in the .ttinclude, that may lead to some bug during the code generation.
Best regards,
Simon
Thanks again for the feedback.
Here are the answers of the problems you have mentioned:
1) The best practice for working with an updated set of templates we recommend in general is to make a copy of them and add it to your solution. This way you can both have them under source control (if any) and used by all team members (if any). Also they will be defended against any unwanted replacement and the old ones will always be available in case you wish to revert your changes.
Not including the best practice in the article is a mistake from our side and it will be addressed. Please find your Telerik points updated.
2) We have double-checked the article but except the problem from point (1) we failed to identify any other discrepancies. Could you please share with us the location of the error you have encountered or any description of what went wrong on your side?
Ivailo
the Telerik team
At #5, the code to locate has changed from
if
(!codeClass.DoubleDerived)
{
this
.GenerateProperties(codeClass.Properties);
//GenerateAssociations(@class);
//GenerateOperations(codeClass.BaseClass.Functions);
if
(codeClass.NestedClasses.Count > 0)
{
this
.GenerateNestedOIDClasses(codeClass);
}
}
this
.WriteLine(classCloseToken);
To
if
(!codeClass.DoubleDerived)
{
this
.GenerateProperties(codeClass.Properties);
//GenerateAssociations(@class);
//GenerateOperations(codeClass.BaseClass.Functions);
//if(codeClass.NestedClasses.Count > 0)
//{
// this.GenerateNestedOIDClasses(codeClass);
//}
}
this
.WriteLine(classCloseToken);
Regards,
Simon
Thanks for the information, I have added some more Telerik points to your account. We will fix this error and add the best practice description in the next couple of weeks.
Ivailo
the Telerik team