MappingSource - static vs non-static member
Posted: Wed 05 Oct 2011 09:00
After updating our project to dotConnect for Mysql to version 6.5 and generating new model class we started to run to high cpu usage and memory-leak problems (on our website) right after a new build was deployed.
After some experiments we realized that the problem is not in new dotConnect version but in the generated class.
And the only change we found was that you replaced static member mappingSource by a (static) method which creates non-static instance of AttributeMappingSource. So for each new instance of data context a new instance of mapping source is created as well.
Is there any reason why mapping source is not static member by default?
And is it recommended to create own static instance of it and pass it to constructor of datacontext class?
Thanks in advance.
After some experiments we realized that the problem is not in new dotConnect version but in the generated class.
And the only change we found was that you replaced static member mappingSource by a (static) method which creates non-static instance of AttributeMappingSource. So for each new instance of data context a new instance of mapping source is created as well.
Is there any reason why mapping source is not static member by default?
And is it recommended to create own static instance of it and pass it to constructor of datacontext class?
Thanks in advance.