Could you please specify whether much time is needed to create a DataContext instance always or only the first time?
Generally, there are several possible ways to speed up creating a DataContext instance:
- Prepare mapping. If you are always connecting to the same server with your data contexts, you can share the mapping metadata between them. For example, if you use the attribute mapping, Entity Developer generates a static 'mappingSource' field of your DataContext descendant. This field is used to store the mapping metadata; it is initialized when creating the first instance of [YourDataContext].
- Prepare connection. If you use the default constructor of [YourDataContext] or pass the connection string to it, the connection object is created inside the DataContext constructor. You can, however, create the connection object before the data context, and pass the connection to the context constructor.
- Compile native images of Devart assemblies. To avoid performance loss caused by compiling native code for Devart assemblies, you can
create native images of Devart assemblies on the machine where you are deploying your application to.
Please tell us if this helps.