MappingSource - static vs non-static member

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
dilbert
Posts: 68
Joined: Tue 28 Apr 2009 10:11

MappingSource - static vs non-static member

Post by dilbert » 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.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 07 Oct 2011 13:51

Thank you for your report, we plan to change this behaviour:
- for the models using MappingMode == 'Attribute', a static MappingSource object will be created and passed to the parameterless constructor of [YourDataContext];
- for the models with MappingMode == 'File', no static mapping source will be used by default.

Passing your own static mapping source to the constructor of your DataContext descendant should not cause any problems.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 17 Nov 2011 08:39

We've implemented these changes. They are available in the latest 3.0.14 build of LinqConnect. The new build can be downloaded from
http://www.devart.com/linqconnect/download.html
(the trial and free versions) or from Registered Users' Area (for users with active subscription only).

For the detailed information about the fixes and improvements available in LinqConnect 3.0.14, please refer to
http://www.devart.com/forums/viewtopic.php?t=22548

Post Reply