/// <summary>
        /// Static constructor.
        /// </summary>
        /// <remarks>
        /// Static initialization of connectionstring and mappingSource.
        /// This significantly increases performance, primarily due to mappingSource cache.
        /// </remarks>        
        static DataContextFactory()
        {
            string connectionStringName = ConfigurationManager.AppSettings.Get("ConnectionStringName");
            _connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;

            DataContext context = new ActionDataContext(_connectionString);
            _mappingSource = context.Mapping.MappingSource;
        }
Exemple #2
0
        /// <summary>
        /// Static constructor.
        /// </summary>
        /// <remarks>
        /// Static initialization of connectionstring and mappingSource.
        /// This significantly increases performance, primarily due to mappingSource cache.
        /// </remarks>
        static DataContextFactory()
        {
            string connectionStringName = ConfigurationManager.AppSettings.Get("ConnectionStringName");

            _connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;

            DataContext context = new ActionDataContext(_connectionString);

            _mappingSource = context.Mapping.MappingSource;
        }