On Sat, 2009-06-13 at 23:43 +0300, Andrus Moor wrote:
> Attached patch increases DataContext() instantion speed for large
> DataContexts.
> OK to commit ?

No.  It's broken.

From:
http://msdn.microsoft.com/en-us/library/system.data.linq.mapping.attributemappingsource.aspx

        Any public static (Shared in Visual Basic) members of this type
        are thread safe. Any instance members are not guaranteed to be
        thread safe.

Since your defaultMappingSource member is static, it would cause the
permit the AttributeMappingSource member to be accessed concurrently
from multiple threads, which is explicitly documented as Not Supported.

There are two fixes for this:

1. Profile AttributeMappingSource and find out why it takes so long to
create.

2. In your code, use the DataContext(IDbConnection, MappingSource) or
DataContext(string, MappingSource) constructors.  This allows you to
provide your own (already constructed) MappingSource value, thus
preventing DataContext from creating a new AttributeMappingSource
instance.

 - Jon



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to